//Update public string update(EmployeeContactCustomerDto tEmployeeContactCustomerDto) { try { EmployeeContactCustomer tEmployeeContactCustomerUpdate = _context.EmployeeContactCustomer.Find(tEmployeeContactCustomerDto.Id); if (tEmployeeContactCustomerUpdate == null) { return("1"); } tEmployeeContactCustomerUpdate.Id = tEmployeeContactCustomerDto.Id; tEmployeeContactCustomerUpdate.EmployeeId = tEmployeeContactCustomerDto.EmployeeId; tEmployeeContactCustomerUpdate.ReceiveEmail = tEmployeeContactCustomerDto.ReceiveEmail; tEmployeeContactCustomerUpdate.MainContact = tEmployeeContactCustomerDto.MainContact; tEmployeeContactCustomerUpdate.Note = tEmployeeContactCustomerDto.Note; tEmployeeContactCustomerUpdate.Status = tEmployeeContactCustomerDto.Status; _context.EmployeeContactCustomer.Update(tEmployeeContactCustomerUpdate); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }
public string create(EmployeeContactCustomerDto tEmployeeContactCustomerDto) { try { EmployeeContactCustomer tEmployeeContactCustomerNew = mapper.Map <EmployeeContactCustomerDto, EmployeeContactCustomer>(tEmployeeContactCustomerDto); tEmployeeContactCustomerNew.Id = Guid.NewGuid().ToString(); // tEmployeeContactCustomerNew.CreateDate = DateTime.Now; _context.EmployeeContactCustomer.Add(tEmployeeContactCustomerNew); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }
public IActionResult Update([FromBody] EmployeeContactCustomerDto value) { string result = _eccService.update(value); return(new ObjectResult(result)); }