Ejemplo n.º 1
0
 /// <summary>
 /// Updae Employer AppService
 /// </summary>
 /// <returns>bool<bool></returns>
 public async Task <bool> UpdateEmployer(EmployerUpdateDTO employerUpdateDTO)
 {
     #region Declare a return type with initial value.
     bool isUpdated = false;
     #endregion
     try
     {
         if (employerUpdateDTO != null)
         {
             isUpdated = await EmployerBusinessMapping.UpdateEmployer(employerUpdateDTO);
         }
     }
     catch (Exception exception) {}
     return(isUpdated);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Mapping User Activity Log DTO to Action
 /// </summary>
 /// <param name=></param>
 /// <param name=></param>
 /// <returns></returns>
 public Employer MappingEmployerupdateDTOToEmployer(Employer employer, EmployerUpdateDTO EmployerUpdateDTO)
 {
     #region Declare Return Var with Intial Value
     Employer Employer = employer;
     #endregion
     try
     {
         if (EmployerUpdateDTO.EmployerId > default(int))
         {
             Employer.FirstName     = EmployerUpdateDTO.FirstName;
             Employer.LastName      = EmployerUpdateDTO.LastName;
             Employer.EmployerId    = EmployerUpdateDTO.EmployerId;
             Employer.BusinessEmail = EmployerUpdateDTO.BusinessEmail;
             Employer.MobileNumber  = EmployerUpdateDTO.MobileNumber;
             Employer.MobileNumber1 = EmployerUpdateDTO.MobileNumber1;
             Employer.ReferralId    = EmployerUpdateDTO.ReferralId;
             Employer.Title         = EmployerUpdateDTO.Title;
         }
     }
     catch (Exception exception) { }
     return(Employer);
 }
        /// <summary>
        /// Update User Action Activity Log
        /// </summary>
        /// <param name=></param>
        /// <returns>bool</returns>
        public async Task <bool> UpdateEmployer(EmployerUpdateDTO EmployerUpdateDTO)
        {
            #region Declare a return type with initial value.
            bool isEmployerUpdated = default(bool);
            #endregion
            try
            {
                if (EmployerUpdateDTO != null)
                {
                    #region Vars
                    Employer Employer = null;
                    #endregion
                    #region Get Activity By Id
                    Employer = await UnitOfWork.EmployerRepository.GetById(EmployerUpdateDTO.EmployerId);

                    #endregion
                    if (Employer != null)
                    {
                        #region  Mapping
                        Employer = EmployerMapping.MappingEmployerupdateDTOToEmployer(Employer, EmployerUpdateDTO);
                        #endregion
                        if (Employer != null)
                        {
                            #region  Update Entity
                            UnitOfWork.EmployerRepository.Update(Employer);
                            isEmployerUpdated = await UnitOfWork.Commit() > default(int);

                            #endregion
                        }
                    }
                }
            }
            catch (Exception exception)
            {
            }
            return(isEmployerUpdated);
        }
        public async Task <ActionResult <CommonAPIResponse <bool> > > UpdateEmployer(EmployerUpdateDTO EmployerUpdateDTO)
        {
            #region Declare return type with initial value.
            JsonResult jsonResult = GetDefaultJsonResult <bool>();
            #endregion

            try
            {
                #region Validate userUpdateDTO for nullability before prepaing the response.
                if (await EmployerAppService.UpdateEmployer(EmployerUpdateDTO))
                {
                    jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.Success, CurrentLanguagId), true, HttpStatusCode.OK);
                }
                else
                {
                    jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidCredentials, CurrentLanguagId), false, HttpStatusCode.BadRequest);
                }
                #endregion
            }
            catch (Exception exception)
            {
            }
            return(jsonResult);
        }