public Owner Create(Owner owner) { var createdOwner = _ctx.Add(owner).Entity; _ctx.SaveChanges(); return(createdOwner); }
public PetType Create(PetType petType) { var createdPetType = _ctx.Add(petType).Entity; _ctx.SaveChanges(); return(createdPetType); }
public Owner CreateOwner(Owner owner) { var newOwner = _ctx.Add(owner).Entity; _ctx.SaveChanges(); return(newOwner); }
public Color Create(Color color) { var addedColor = _ctx.Add(color).Entity; _ctx.SaveChanges(); return(addedColor); }
public Pet AddPet(Pet pet) { //pet.Id = DbInitializer.GetNextPetId(); pet.Id = 0; _ctx.Add(pet); _ctx.SaveChanges(); return(pet); }
public async Task <IActionResult> Post([FromBody] CarShopping value) { using (var _db = new PetShopContext()) { _db.Add(new CarShopping { IdUser = value.IdUser, IdProduct = value.IdProduct }); await _db.SaveChangesAsync(); return(Ok(value)); } }
public async Task <IActionResult> Post(Purchale value) { using (var _db = new PetShopContext()) { var date = DateTime.Now; _db.Add(new Purchale { Date = date, IdUser = value.IdUser, IdProduct = value.IdProduct }); await _db.SaveChangesAsync(); return(Ok(value)); } }
public async Task <IActionResult> Post([FromBody] Product value) { using (var _db = new PetShopContext()) { _db.Add(new Product { Name = value.Name, Stock = value.Stock, Description = value.Description, Photo = value.Photo, Price = value.Price }); await _db.SaveChangesAsync(); return(Ok(value)); } }
public Pet Create(Pet pet) { if (pet.owner != null) { pet.owner = _ctx.Owners.FirstOrDefault(o => o.id == pet.owner.id); } /*if (pet.colors != null) * { * for (int i = 0; i < pet.colors.Count; i++) * { * = _ctx.Colors.FirstOrDefault(c => c.id == ); * } * * }*/ var addedPet = _ctx.Add(pet).Entity; _ctx.SaveChanges(); return(pet); }
public async Task <IActionResult> CreateSopstvenik(SopstvenikVM model) { if (ModelState.IsValid) { string uniqueFileName = UploadedFile(model); Sopstvenik sopstvenik = new Sopstvenik { ImePrezime = model.ImePrezime, ImeMilenik = model.ImeMilenik, Email = model.Email, Grad = model.Grad, ProfilePicture = uniqueFileName, }; _context.Add(sopstvenik); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(IndexSopstvenik))); } return(View(model)); }
public async Task <IActionResult> Create(PhotoVM model) { if (ModelState.IsValid) { string uniqueFileName = UploadedFile(model); Produkt produkt = new Produkt { Ime = model.Ime, NamenetoZa = model.NamenetoZa, Cena = model.Cena, ProfilePicture = uniqueFileName, }; _context.Add(produkt); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(model)); }
public void Add <T>(T entity) where T : class { _context.Add(entity); }
public Owner CreateOwner(Owner owner) { _ctx.Add(owner); _ctx.SaveChanges(); return(owner); }
public void CreateOwner(Owner owner) { _ctx.Add(owner); _ctx.SaveChanges(); }
public void CreatePet(Pet pet) { _ctx.Add(pet); _ctx.SaveChanges(); }
public Pet CreatePet(Pet pet) { _ctx.Add(pet); _ctx.SaveChanges(); return(pet); }