//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 EmployeeContactCustomerDto get(string id) { try { EmployeeContactCustomer bb = _context.EmployeeContactCustomer.Find(id); // _context.Entry(bb).Reference(ct => ct.Country).Load(); // _context.Entry(bb).Collection(bbr => bbr.BankBranch).Load(); // _context.Entry(bb).Collection(b => b.Customer).Load(); return(mapper.Map <EmployeeContactCustomer, EmployeeContactCustomerDto>(bb)); } catch (Exception) { return(null); } }
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 string delete(string id) { try { EmployeeContactCustomer tEmployeeContactCustomerRemove = _context.EmployeeContactCustomer.Find(id); if (tEmployeeContactCustomerRemove == null) { return("1"); } _context.EmployeeContactCustomer.Remove(tEmployeeContactCustomerRemove); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }
public string lockItem(string id) { try { EmployeeContactCustomer tEmployeeContactCustomerBlock = _context.EmployeeContactCustomer.Find(id); if (tEmployeeContactCustomerBlock == null) { return("1"); } tEmployeeContactCustomerBlock.Status = false; _context.EmployeeContactCustomer.Update(tEmployeeContactCustomerBlock); _context.SaveChanges(); return("0"); } catch (Exception) { return("1"); } }