public IActionResult Post([FromBody] company value) { var company = new company(); company.companyId = value.companyId; company.name = value.name; company.isActive = true; _context.company.Add(company); _context.SaveChanges(); var send = _context.company.Where(c => c.companyId == company.companyId).FirstOrDefault <company>(); return(Ok(send)); }
public IActionResult Post([FromBody] equipmenttype value) { var equipmenttype = new equipmenttype(); equipmenttype.equipmenttypeId = value.equipmenttypeId; equipmenttype.name = value.name; equipmenttype.isActive = true; _context.equipmenttype.Add(equipmenttype); _context.SaveChanges(); var send = _context.equipmenttype.Where(c => c.equipmenttypeId == equipmenttype.equipmenttypeId).FirstOrDefault <equipmenttype>(); return(Ok(send)); }
public IActionResult Post([FromBody] equipment value) { var equipment = new equipment(); if (value.equipmenttype != null) { equipment.equipmenttypeId = value.equipmenttype.equipmenttypeId; } equipment.name = value.name; equipment.isActive = true; _context.equipment.Add(equipment); _context.SaveChanges(); var send = _context.equipment.Include(e => e.equipmenttype).Where(c => c.equipmentId == equipment.equipmentId).FirstOrDefault <equipment>(); return(Ok(send)); }
public IActionResult Post([FromBody] crash value) { var crash = new crash(); copydata(value, crash); adddetail(value, crash); _context.crash.Add(crash); _context.SaveChanges(); _logger.LogInformation("Travel post"); var send = getById(crash.crashId); return(new OkObjectResult(JsonConvert.SerializeObject(send, Formatting.None, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }))); //Loop referencing //return Ok(send); }