This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <ul> | |
| <li v-for="item in data"> | |
| {{ item.title }} | |
| </li> | |
| </ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <ul> | |
| <li *ngFor="let item of data"> | |
| {{ item.title }} | |
| </li> | |
| </ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| render() { | |
| return ( | |
| <ul> | |
| { | |
| data.map(item => { | |
| return <li key={item.id}>{item.title}</li> | |
| }); | |
| } | |
| </ul> | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void ConfigureServices(IServiceCollection services) | |
| { | |
| services.AddDbContext<ApplicationDbContext>(); | |
| services.AddMvc(); | |
| } | |
| public void Configure( | |
| IApplicationBuilder app, | |
| IHostingEnvironment env, | |
| ApplicationDbContext dbContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.AspNetCore.Mvc; | |
| using SimpleCrudApi.Entities; | |
| namespace SimpleCrudApi.Controllers | |
| { | |
| [Route("User/[action]")] | |
| public class UserController : SimpleCrudController<User, int> | |
| { | |
| public UserController(ApplicationDbContext dbContext) : base(dbContext) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Mvc; | |
| using SimpleCrudApi.Entities; | |
| namespace SimpleCrudApi.Controllers | |
| { | |
| public class SimpleCrudController<T, TKey> : Controller | |
| where T : class | |
| where TKey : IEquatable<TKey> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Linq; | |
| using System.Threading.Tasks; | |
| namespace SimpleCrudApi.Entities | |
| { | |
| public interface ISimpleCrudService<T, TKey> | |
| where T : class | |
| where TKey : IEquatable<TKey> | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Threading.Tasks; | |
| using Microsoft.EntityFrameworkCore; | |
| using Microsoft.EntityFrameworkCore.ChangeTracking; | |
| namespace SimpleCrudApi.Entities | |
| { | |
| // TODO: Implement IRepository interface later | |
| public class Repository<T, TKey> : IRepository<T, TKey> | |
| where T : class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Linq; | |
| using System.Linq.Expressions; | |
| using System.Threading.Tasks; | |
| using Microsoft.EntityFrameworkCore; | |
| namespace SimpleCrudApi.Entities | |
| { | |
| // TODO: Implement IRepository interface later | |
| public class Repository |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.EntityFrameworkCore; | |
| namespace SimpleCrudApi.Entities | |
| { | |
| public class ApplicationDbContext : DbContext | |
| { | |
| public DbSet<User> Users { get; set; } | |
| public DbSet<Announcement> Announcements { get; set; } | |
| protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |