public void Add(BranchProfileDTO DTO) { using (var container = new InventoryContainer()) { InvenBranchProfile gur = new InvenBranchProfile(); container.InvenBranchProfiles.AddObject((InvenBranchProfile)DTOMapper.DTOObjectConverter(DTO, gur)); container.SaveChanges(); } }
public void Edit(BranchProfileDTO DTO) { using (var container = new InventoryContainer()) { var Br = new InvenBranchProfile(); Br = container.InvenBranchProfiles.FirstOrDefault(o => o.BrProId.Equals(DTO.BrProId)); Br.CompProId = DTO.CompProId; Br.BrAddress = DTO.BrAddress; Br.BrDescription = DTO.BrDescription; Br.BrEmail = DTO.BrEmail; Br.BrMobile1 = DTO.BrMobile1; Br.BrMobile2 = DTO.BrMobile2; Br.BrPhone = DTO.BrPhone; Br.BrProId = DTO.BrProId; Br.BrProName = DTO.BrProName; Br.BrWebsite = DTO.BrWebsite; Br.UpdateBy = DTO.UpdateBy; Br.UpdateDate = DTO.UpdateDate; Br = (InvenBranchProfile)DTOMapper.DTOObjectConverter(DTO, Br); container.SaveChanges(); } }