Beispiel #1
0
        public JsonResult UpadateStaffProfile(StaffProfileViewModel profileViewModel)
        {
            try
            {
                var hrpEmployee = _context.HrpEmployee.FirstOrDefault(e => e.EmpNo == profileViewModel.EmpNo);
                if (hrpEmployee != null)
                {
                    hrpEmployee.Cell    = profileViewModel.Cell;
                    hrpEmployee.Country = profileViewModel.Country;
                    hrpEmployee.Address = profileViewModel.Address;
                    hrpEmployee.City    = profileViewModel.City;
                    hrpEmployee.County  = profileViewModel.County;

                    _context.SaveChanges();
                }

                return(Json(new ReturnData <string>
                {
                    Success = true,
                    Message = "Profile Updated Successifully"
                }));
            }
            catch (Exception ex)
            {
                return(Json(new ReturnData <string>
                {
                    Success = false,
                    Message = "An error occurred,please retry : " + ex.Message
                }));
            }
        }
Beispiel #2
0
        public JsonResult EditStaffProfile(StaffProfileViewModel profileViewModel)
        {
            var token = _tokenValidator.Validate(HttpContext);

            if (!token.Success)
            {
                return(Json(new ReturnData <string>
                {
                    Success = false,
                    NotAuthenticated = true,
                    Message = $"Unauthorized:-{token.Message}",
                }));
            }
            var updateProfileResults = _unisolApiProxy.EditStaffProfile(profileViewModel).Result;
            var jdata = JsonConvert.DeserializeObject <ReturnData <string> >(updateProfileResults);

            return(Json(jdata));
        }
Beispiel #3
0
        public Task <string> EditStaffProfile(StaffProfileViewModel profileViewModel)
        {
            var response = Post("profile/upadateStaffProfile/", profileViewModel);

            return(response);
        }