public HttpResponseMessage InsertUpdateSecurityFormControl([FromBody] SecurityFormControlEntity securityFormControlEntity)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Please provide all the required fields."));
            }

            if (_securityFormControlService.CreateUpdateSecurityFormControl(securityFormControlEntity))
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "true"));
            }

            return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "false"));
        }
        public bool CreateUpdateSecurityFormControl(SecurityFormControlEntity securityFormControl)
        {
            using (var scope = new TransactionScope())
            {
                SecurityFormControl sc = new SecurityFormControl()
                {
                    Name     = securityFormControl.Name,
                    ParentId = securityFormControl.ParentId,
                    SecurityFormControlId = securityFormControl.SecurityFormControlId,
                    SecurityFormId        = securityFormControl.SecurityFormId,
                    CreatedBy             = securityFormControl.CreatedBy,
                    CreatedDate           = securityFormControl.CreatedDate,
                    Inactive          = securityFormControl.Inactive,
                    LastModBy         = securityFormControl.LastModBy,
                    LastModDate       = securityFormControl.LastModDate,
                    SecurityControlId = securityFormControl.SecurityControlId
                };

                if (securityFormControl.SecurityFormControlId > 0)
                {
                    sc.LastModDate = DateTime.Now;
                    _unitOfWork.SecurityFormControlRepository.Update(sc);
                    _unitOfWork.Save();
                    scope.Complete();
                }
                else
                {
                    sc.LastModDate = DateTime.Now;
                    sc.CreatedDate = DateTime.Now;
                    _unitOfWork.SecurityFormControlRepository.Insert(sc);
                    _unitOfWork.Save();
                    scope.Complete();
                }
                return(true);
            }
        }