public IActionResult EditRestaurent(string id, Restaurent res) { if (id != null) { res.Name = "updateRes"; res.Discription = "updateTest"; } return(this.Ok(res)); }
public IActionResult OnGet(int id) { Restaurent = _restaurentData.Get(id); if (Restaurent == null) { return(RedirectToAction("Index", "Home")); } return(Page()); }
public IActionResult Create(Restaurent restaurent) { if (ModelState.IsValid) { restaurent = _restaurent.Add(restaurent); return(RedirectToAction(nameof(Details), new { id = restaurent.Id })); } else { return(View()); } }
public IActionResult Create(EditRestaurentViewModel restaurent) { if (ModelState.IsValid) { Restaurent aRestaurent = new Restaurent(); aRestaurent.Name = restaurent.Name; aRestaurent.Type = restaurent.Type; _restaurentData.Add(aRestaurent); return(RedirectToAction("Details", new { id = aRestaurent.Id })); } return(View()); }
public Restaurent Add(Restaurent restaurent) { //_restaurant.Restaurents.Add(restaurent); //_restaurant.SaveChanges(); //return restaurent; //var result = _restaurant.Database.ExecuteSqlCommand("spInsertion @Name, @City, @ContactNumber", parameters: new[] { // restaurent.Name, // restaurent.City, // restaurent.ContactNumber.ToString() //}); Restaurent result = _restaurant.Set <Restaurent>().FromSql("spInsertion @Name={0} ,@City ={1}, @ContactNumber={2}", restaurent.Name, restaurent.City, restaurent.ContactNumber).Single(); return(result); }
public Restaurent Edit(Restaurent restaurent) { throw new NotImplementedException(); }
public Restaurent Add(Restaurent restaurent) { restaurent.Id = _restaurents.Max(a => a.Id) + 1; _restaurents.Add(restaurent); return(restaurent); }
public IActionResult SaveRestaurent([FromBody] Restaurent res) { res.Id = Guid.NewGuid().ToString(); return(this.Ok(res)); }
public void Add(Restaurent aRestaurent) { context.Restaurents.Add(aRestaurent); context.SaveChanges(); }
public Restaurent Edit(Restaurent restaurent) { _restaurant.Attach(restaurent).State = EntityState.Modified; _restaurant.SaveChanges(); return(restaurent); }