public async Task <IActionResult> Edit(long id, [Bind("Id,Name,Idaddress,Idcategory,Description,MemberCount,Rating,IdcontactDetails,WomenPercentage,Sentiment")] RoboticEntity roboticEntity) { if (id != roboticEntity.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(roboticEntity); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoboticEntityExists(roboticEntity.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Idaddress"] = new SelectList(_context.Address, "Id", "AddressDetails", roboticEntity.Idaddress); ViewData["Idcategory"] = new SelectList(_context.Category, "Id", "Name", roboticEntity.Idcategory); ViewData["IdcontactDetails"] = new SelectList(_context.ContactDetails, "Id", "Id", roboticEntity.IdcontactDetails); return(View(roboticEntity)); }
public async Task <IActionResult> Create([Bind("Id,Name,Idaddress,Idcategory,Description,MemberCount,Rating,IdcontactDetails,WomenPercentage,Sentiment")] RoboticEntity roboticEntity) { if (ModelState.IsValid) { _context.Add(roboticEntity); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Idaddress"] = new SelectList(_context.Address, "Id", "AddressDetails", roboticEntity.Idaddress); ViewData["Idcategory"] = new SelectList(_context.Category, "Id", "Name", roboticEntity.Idcategory); ViewData["IdcontactDetails"] = new SelectList(_context.ContactDetails, "Id", "Id", roboticEntity.IdcontactDetails); return(View(roboticEntity)); }