Skip to content

Commit

Permalink
fix for observable operator and incorrect property set
Browse files Browse the repository at this point in the history
  • Loading branch information
asadsahi committed Mar 14, 2017
1 parent 93d8a4a commit f7b43fd
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 55 deletions.
5 changes: 3 additions & 2 deletions Client/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import './polyfills';
import './styles/vendor.css';
import 'rxjs/Rx';

import 'rxjs/add/operator/map';
// import 'rxjs/add/operator/select';
import 'rxjs/add/operator/first';
import 'rxjs/add/operator/finally';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/interval';
import 'rxjs/add/observable/throw';

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
Expand Down
6 changes: 3 additions & 3 deletions Server/Controllers/api/ContentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public IActionResult Get(string lang)
{
var contentCacheKey = "ContentKey" + lang;
var result = (from c in _context.Content
join t in _context.ContentText on c._id equals t.ContentId
join l in _context.Languageses on t.LanguageId equals l._id
join t in _context.ContentText on c.Id equals t.ContentId
join l in _context.Languageses on t.LanguageId equals l.Id
where l.Locale == lang
select new ContentVm
{
Expand All @@ -49,7 +49,7 @@ public IActionResult Post(ContentVm model)
var content = _context.Content.FirstOrDefault(c => c.Key == model.Key);
if (content != null)
{
var contentText = _context.ContentText.FirstOrDefault(t => t.ContentId == content._id);
var contentText = _context.ContentText.FirstOrDefault(t => t.ContentId == content.Id);
if (contentText != null)
{
contentText.Text = model.Value;
Expand Down
2 changes: 1 addition & 1 deletion Server/Entities/ContactUs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace AspNetCoreSpa.Server.Entities
public class ContactUs : IEntityBase
{
[Key]
public int _id { get; set; }
public int Id { get; set; }
[Required]
[StringLength(255, MinimumLength = 5)]
public string Name { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Server/Entities/Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace AspNetCoreSpa.Server.Entities
public class Content : IEntityBase
{
[Key]
public int _id { get; set; }
public int Id { get; set; }
[Required]
[StringLength(250)]
public string Key { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Server/Entities/IEntityBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
public interface IEntityBase
{
int _id { get; set; }
int Id { get; set; }
}
}
2 changes: 1 addition & 1 deletion Server/Entities/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace AspNetCoreSpa.Server.Entities
public class Language : IEntityBase
{
[Key]
public int _id { get; set; }
public int Id { get; set; }
[Required]
[MaxLength(7)]
public string Locale { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Server/Entities/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace AspNetCoreSpa.Server.Entities
{
public class Product : IEntityBase
public class Product
{
[Key]
public int _id { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions Server/Repositories/EntityBaseRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public virtual async Task<IEnumerable<T>> AllIncludingAsync(params Expression<Fu
}
public T GetSingle(int id)
{
return _context.Set<T>().FirstOrDefault(x => x._id == id);
return _context.Set<T>().FirstOrDefault(x => x.Id == id);
}

public T GetSingle(Expression<Func<T, bool>> predicate)
Expand All @@ -73,7 +73,7 @@ public T GetSingle(Expression<Func<T, bool>> predicate, params Expression<Func<T

public async Task<T> GetSingleAsync(int id)
{
return await _context.Set<T>().FirstOrDefaultAsync(e => e._id == id);
return await _context.Set<T>().FirstOrDefaultAsync(e => e.Id == id);
}
public virtual IEnumerable<T> FindBy(Expression<Func<T, bool>> predicate)
{
Expand Down
18 changes: 9 additions & 9 deletions Server/SeedDbData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ private void AddLanguagesAndContent()
{
if (!_context.Languageses.Any())
{
_context.Languageses.Add(new Language { _id = 1, Locale = "en", Description = "English" });
_context.Languageses.Add(new Language { _id = 2, Locale = "fr", Description = "Frensh" });
_context.Languageses.Add(new Language { Id = 1, Locale = "en", Description = "English" });
_context.Languageses.Add(new Language { Id = 2, Locale = "fr", Description = "Frensh" });
_context.SaveChanges();
}

if (!_context.Content.Any())
{
_context.Content.Add(new Content { _id = 1, Key = "TITLE" });
_context.Content.Add(new Content { _id = 2, Key = "APP_NAV_HOME" });
_context.Content.Add(new Content { _id = 3, Key = "APP_NAV_EXAMPLES" });
_context.Content.Add(new Content { _id = 4, Key = "APP_NAV_LOGIN" });
_context.Content.Add(new Content { _id = 5, Key = "APP_NAV_LOGOUT" });
_context.Content.Add(new Content { _id = 6, Key = "APP_NAV_REGISTER" });
_context.Content.Add(new Content { _id = 7, Key = "APP_NAV_ADMIN" });
_context.Content.Add(new Content { Id = 1, Key = "TITLE" });
_context.Content.Add(new Content { Id = 2, Key = "APP_NAV_HOME" });
_context.Content.Add(new Content { Id = 3, Key = "APP_NAV_EXAMPLES" });
_context.Content.Add(new Content { Id = 4, Key = "APP_NAV_LOGIN" });
_context.Content.Add(new Content { Id = 5, Key = "APP_NAV_LOGOUT" });
_context.Content.Add(new Content { Id = 6, Key = "APP_NAV_REGISTER" });
_context.Content.Add(new Content { Id = 7, Key = "APP_NAV_ADMIN" });
_context.SaveChanges();
}

Expand Down
104 changes: 70 additions & 34 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,64 @@
# yarn lockfile v1


"@angular/[email protected]":
version "4.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/common/-/common-4.0.0-rc.2.tgz#69f68639270d71b2e8c552e4fa939975fcb88304"
"@angular/[email protected]":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-4.0.0-rc.3.tgz#e294cbc6b3a9404811377c537aad478ad953b7b8"

"@angular/[email protected]":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/common/-/common-4.0.0-rc.3.tgz#315d12daf02d0fb12d9cab937d28986ad26559f3"

"@angular/[email protected]":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-4.0.0-rc.3.tgz#e1d46af4aa86f21613678421b307d7842fafbba7"
dependencies:
"@angular/tsc-wrapped" "4.0.0-rc.2"
minimist "^1.2.0"
reflect-metadata "^0.1.2"

"@angular/compiler-cli@4.0.0-rc.2", "@angular/compiler-cli@^4.0.0-rc.1":
"@angular/compiler-cli@^4.0.0-rc.1":
version "4.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-4.0.0-rc.2.tgz#49730cb232d48aba25d68541eb9166bf5330dd2b"
dependencies:
"@angular/tsc-wrapped" "4.0.0-rc.2"
minimist "^1.2.0"
reflect-metadata "^0.1.2"

"@angular/[email protected].2":
version "4.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-4.0.0-rc.2.tgz#643e199e6792413f42cf149a9cf1672284787c11"
"@angular/[email protected].3":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-4.0.0-rc.3.tgz#a844c76700594dc001ddf0336c2c3f8968e5a343"

"@angular/[email protected].2":
version "4.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-4.0.0-rc.2.tgz#59535050e5d0e6141417186eee571296f8e9c3d0"
"@angular/[email protected].3":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/core/-/core-4.0.0-rc.3.tgz#a0a0a7e3841d982b496e2ed6516f6bc05493640e"

"@angular/[email protected].2":
version "4.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-4.0.0-rc.2.tgz#6d9df97783b6023d652d97369db13d6ad6c7fa9e"
"@angular/[email protected].3":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-4.0.0-rc.3.tgz#80338a3ae8bea758282b57ada47199576bdf965e"

"@angular/[email protected].2":
version "4.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/http/-/http-4.0.0-rc.2.tgz#145ecd17f483b97e7750bb9e00b60e48ff82b67a"
"@angular/[email protected].3":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/http/-/http-4.0.0-rc.3.tgz#4d34f2488e5cd3fa8644842e5b4833a921a4988b"

"@angular/[email protected].2":
version "4.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-4.0.0-rc.2.tgz#f2bbab322706dc6361d46647e1e2b7c26f036a1c"
"@angular/[email protected].3":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-4.0.0-rc.3.tgz#095441028433d56062d21f38ff08ab15a46b577f"

"@angular/[email protected].2":
version "4.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-4.0.0-rc.2.tgz#bcca05ce85d320ee0b257640f15479b59fed20f0"
"@angular/[email protected].3":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-4.0.0-rc.3.tgz#94ca2f0085f739dc0dadd78f060c1d6135d8a220"

"@angular/[email protected].2":
version "4.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-4.0.0-rc.2.tgz#3b09f4e2f2dc1b7d723fbbdc6b99117019c0f9de"
"@angular/[email protected].3":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-4.0.0-rc.3.tgz#3aa12a6f49ea30d14b87bf007ad25c85c30c15f6"
dependencies:
parse5 "^3.0.1"
xhr2 "^0.1.4"

"@angular/[email protected].2":
version "4.0.0-rc.2"
resolved "https://registry.yarnpkg.com/@angular/router/-/router-4.0.0-rc.2.tgz#66fc5be012caa38441314d0a0b9c9b6a723c471a"
"@angular/[email protected].3":
version "4.0.0-rc.3"
resolved "https://registry.yarnpkg.com/@angular/router/-/router-4.0.0-rc.3.tgz#dc66167d55d88b626e01a337bef20750c903e5a6"

"@angular/[email protected]":
version "4.0.0-rc.2"
Expand Down Expand Up @@ -238,6 +250,10 @@ amdefine@>=0.0.4, amdefine@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.0.tgz#fd17474700cb5cc9c2b709f0be9d23ce3c198c33"

[email protected]:
version "0.17.0"
resolved "https://registry.yarnpkg.com/angular2-google-maps/-/angular2-google-maps-0.17.0.tgz#ad8366fa4e5c56de0b8b20f003b5f7a1da06ffe3"

[email protected]:
version "0.1.28"
resolved "https://registry.yarnpkg.com/angular2-jwt/-/angular2-jwt-0.1.28.tgz#4896dbb88ec561382cf485ff9eaa6f96a683f4d1"
Expand Down Expand Up @@ -941,6 +957,16 @@ [email protected]:
source-map "^0.5.6"
sprintf-js "^1.0.3"

codemirror-spell-checker@*:
version "1.1.2"
resolved "https://registry.yarnpkg.com/codemirror-spell-checker/-/codemirror-spell-checker-1.1.2.tgz#1c660f9089483ccb5113b9ba9ca19c3f4993371e"
dependencies:
typo-js "*"

codemirror@*:
version "5.24.2"
resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.24.2.tgz#b55ca950fa009709c37df68eb133310ed89cf2fe"

color-convert@^1.3.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a"
Expand Down Expand Up @@ -2717,7 +2743,7 @@ jodid25519@^1.0.0:
dependencies:
jsbn "~0.1.0"

jquery@>=1.6.4, jquery@>=1.9.1:
jquery@>=1.9.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.1.1.tgz#347c1c21c7e004115e0a4da32cece041fad3c8a3"

Expand Down Expand Up @@ -3165,7 +3191,7 @@ map-stream@~0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/map-stream/-/map-stream-0.1.0.tgz#e56aa94c4c8055a16404a0674b78f215f7c8e194"

marked@^0.3.5:
marked@*, marked@^0.3.5:
version "0.3.6"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.6.tgz#b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7"

Expand Down Expand Up @@ -4643,11 +4669,13 @@ signal-exit@^3.0.0:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"

[email protected]:
version "2.2.1"
resolved "https://registry.yarnpkg.com/signalr/-/signalr-2.2.1.tgz#61123440fda2a9ad7bf7dfca1e1af67853c1dd2c"
simplemde@^1.11.2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/simplemde/-/simplemde-1.11.2.tgz#a23a35d978d2c40ef07dec008c92f070d8e080e3"
dependencies:
jquery ">=1.6.4"
codemirror "*"
codemirror-spell-checker "*"
marked "*"

slide@^1.1.5:
version "1.1.6"
Expand Down Expand Up @@ -4997,6 +5025,10 @@ timers-browserify@^2.0.2:
dependencies:
setimmediate "^1.0.4"

tinymce@^4.5.5:
version "4.5.5"
resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-4.5.5.tgz#71d18582771a8cef8531b94ebb10984d0260074c"

[email protected]:
version "0.0.24"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.24.tgz#d6a5e198d14a9835cc6f2d7c3d9e302428c8cf12"
Expand Down Expand Up @@ -5165,6 +5197,10 @@ [email protected]:
version "2.2.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.2.1.tgz#4862b662b988a4c8ff691cc7969622d24db76ae9"

typo-js@*:
version "1.0.3"
resolved "https://registry.yarnpkg.com/typo-js/-/typo-js-1.0.3.tgz#54d8ebc7949f1a7810908b6002c6841526c99d5a"

[email protected], uglify-js@^2.6, uglify-js@^2.7.5:
version "2.7.5"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.5.tgz#4612c0c7baaee2ba7c487de4904ae122079f2ca8"
Expand Down

0 comments on commit f7b43fd

Please sign in to comment.