I'm trying to create just the back-end part for a simple CRUD project. I'm completely new to asp.net and currently reading as I go. But I got stuck.
I've created the entities (models) I need
public class VehicleMakeEntity
{
public int Id { get; set; }
public string Name { get; set; }
public string Abrv { get; set; }
public VehicleMakeEntity Make { get; set; }
}
I've also created a standard DbContext class and the repositories
class MakeRepository : IMakeRepository
{
ProjectDbContext context;
public MakeRepository(ProjectDbContext context)
{
this.context = context;
}
public void Delete(VehicleMakeEntity entity)
{
context.VehicleMake.Remove(entity);
context.SaveChanges();
Console.WriteLine(entity.Make.Name);
}
public void Insert(VehicleMakeEntity entity)
{
context.VehicleMake.Add(entity);
context.SaveChanges();
}
public void Update(VehicleMakeEntity entity)
{
context.VehicleMake.Update(entity);
context.SaveChanges();
}
public void Dispose()
{
context.Dispose();
}
}
Now the problem I have is I cannot find any documentation that both doesn't use MVC and uses repositories. I need to create a service class that implements basic paging, sorting and filtering but everything I look at Like this uses MVC and I have no idea how to convert it to my project.