Exemple #1
0
        public async Task <IActionResult> UpdateDetail(int id, [FromBody] UpdateProfileParam param)
        {
            var model = new UserDetailMediCoreModel
            {
                Id        = id,
                UserId    = _authServices.GetUserId() ?? 0,
                PatientId = param.PatientId.HasValue ? param.PatientId : null,
                FirstName = param.FirstName,
                LastName  = param.LastName,
                Address   = param.Address,
                RegencyId = param.RegencyId
            };

            model.Patient = new PatientModel
            {
                Id                 = param.PatientId ?? 0,
                PatientName        = String.Format("{0} {1}", param.FirstName, param.LastName),
                DateOfBirth        = param.DateOfBirth,
                PatientStatus      = PatientStatus.Active,
                Gender             = param.Gender,
                RelationshipStatus = RelationshipStatus.YourSelf,
                AssociatedUserId   = model.UserId
            };
            var response = await _userDetailService.EditWithPatientAsync(model);

            if (response.Success)
            {
                return(Ok(response.Item));
            }

            return(BadRequest(response.Message));
        }