public async Task <IActionResult> Create([Bind("Id,Name")] Contractor contractor) { if (ModelState.IsValid) { _context.Add(contractor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(contractor)); }
public async Task <string> PostAsync([FromBody] CameraInfo cameraInfo) { if (ModelState.IsValid) { _context.Add(cameraInfo); await _context.SaveChangesAsync(); return("ok"); } return("error"); }
public async Task <IActionResult> Create([Bind("Id,Lat,Lng,Img,Rating")] CameraInfo cameraInfo) { if (ModelState.IsValid) { _context.Add(cameraInfo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cameraInfo)); }
public async Task <IActionResult> Create([Bind("Id,Type,DeviceId")] Sign sign) { if (ModelState.IsValid) { _context.Add(sign); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(sign)); }
public async Task <IActionResult> Create([Bind("Id,Name,ContractorId")] Work work) { if (ModelState.IsValid) { _context.Add(work); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ContractorId"] = new SelectList(_context.Contractors, "Id", "Name", work.ContractorId); return(View(work)); }
public async Task <string> PostAsync([FromQuery] SignInfo signInfo) { if (ModelState.IsValid) { var signId = signInfo.SignId; var sign = await _context.Sign.FirstOrDefaultAsync(i => i.Id == signId); var workId = sign.WorkId; signInfo.WorkId = workId; signInfo.Created = DateTime.Now; sign.Lat = signInfo.Lat; sign.Lng = signInfo.Lng; _context.Add(signInfo); await _context.SaveChangesAsync(); return("ok"); } return("error"); }