public async Task <IActionResult> Create([Bind("checkId,checkName")] check check) { if (ModelState.IsValid) { _context.Add(check); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(check)); }
public IActionResult CreateFood(Foodviewmode food) { if (ModelState.IsValid) { string uniqueFileName = Photopathfood(food); myfoods newfood = new myfoods { myfoodsName = food.foodName, foodCalories = food.foodCalories, photopath = uniqueFileName, Price = food.price, photopath11 = "jjjjj" }; //if (Image != null) _Context.Add(newfood); _Context.SaveChanges(); return(RedirectToAction(nameof(FoodList))); } return(View(food)); }
public async Task <IActionResult> Create([Bind("azizId,azizName")] aziz aziz) { if (ModelState.IsValid) { _context.Add(aziz); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(aziz)); }
public async Task <IActionResult> Create([Bind("noriId,noriName")] nori nori) { if (ModelState.IsValid) { _context.Add(nori); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(nori)); }
public string Post([FromBody] check value) { if (!_context.check.Any(user => user.checkId.Equals(value.checkId))) { check tblUser = new check(); // tblUser.checkId= value.checkId; tblUser.checkName = value.checkName; try { _context.Add(tblUser); _context.SaveChanges(); return(JsonConvert.SerializeObject("register succefully")); } catch (Exception ex) { return(JsonConvert.SerializeObject(ex.Message)); } } else { return(JsonConvert.SerializeObject("User is existing in database")); } }