public IHttpActionResult AddCustomer(CustomerView objCustomerRec) { try { CustomerRecord objCustomerData = new CustomerRecord(); objCustomerRec.CopyProperties(objCustomerData); _CustomerService.Create(objCustomerData); if (objCustomerRec.FK_CommiteId > 0) { CommiteMember member = new CommiteMember(); member.FK_CommiteId = objCustomerRec.FK_CommiteId; member.FK_CustomerId = objCustomerData.Id; member.IsActive = true; member.CreatedDate = member.UpdatedDate = System.DateTime.Now; member.UpdatedBy = member.CreatedBy = objCustomerData.CreatedBy; _MemberService.Create(member); } return(Ok(objCustomerRec)); } catch (Exception ex) { throw ex; } }
public IHttpActionResult AddCommiteMembers(CommiteMember objCommiteMemeber) { try { var memberExist = _MemberService.GetAll().Where(x => x.FK_CommiteId == objCommiteMemeber.FK_CommiteId && x.FK_CustomerId == objCommiteMemeber.FK_CustomerId).FirstOrDefault(); if (memberExist != null) { _MemberService.Create(objCommiteMemeber); return(Ok(objCommiteMemeber)); } else { return(Ok(new { Error = true, Message = "User already Exist" })); } } catch (Exception ex) { throw ex; } }