public bool AddUpdateDeleteCustomer(CustomerDetail Customer, string action) { bool isSuccess = true; try { //brand.App_User = ReadConfigData.GetDBLoginUser(); //brand.Audit_User = GlobalUser.getGlobalUser().UserName; //brand.RegionID = Convert.ToInt32(GlobalUser.getGlobalUser().RegionID); //brand.DisplayOrder = 1; //brand.VersionDataID = vid; //brand.VersionAction = action; if (action == "I") { Insert(Customer); } else if (action == "U") { Update(Customer); } else if (action == "D") { Delete(Customer); } _unitOfWork.SaveChanges(); } catch (Exception ex) { isSuccess = false; throw ex; } return isSuccess; }
public void Delete(CustomerDetail Customer) { _customerdetailsRepository.Delete(Customer); }
public CustomerDetail Insert(CustomerDetail Customer) { _customerdetailsRepository.Insert(Customer); return Customer; }
public CustomerDetail Update(CustomerDetail Customer) { _customerdetailsRepository.Update(Customer); return Customer; }
public string ValidateCustomer(CustomerDetail Customerchk, string action) { string result = string.Empty; if (action == "I") { var custList = _customerdetailsRepository.Query(u => u.CustomerName == Customerchk.CustomerName).Select(); if (custList.ToList().Count > 0) { if (custList.Where(u => u.CustomerName == Customerchk.CustomerName).FirstOrDefault() != null) { result = "Customer Name already exists!"; return result; } } } else if (action == "U") { var custList = _customerdetailsRepository.Query(u => u.CustomerName != Customerchk.CustomerName).Select(); if (custList.ToList().Count > 0) { return result; } } return result; }