Пример #1
0
        /// <summary>
        /// Actualiza un elemento en la base de datos. (Capa de Negocio)
        /// </summary>
        /// <param name=""></param>
        public static bool UpdateProfile(Guid UserId, string PropertyNames, string PropertyValuesString, byte[] PropertyValuesBinary, DateTime LastUpdatedDate)
        {
            ProfilesDAL profileDAL = null;
            bool        bResult    = false;

            profileDAL = new ProfilesDAL();
            try
            {
                try
                {
                    profileDAL.Update(UserId, PropertyNames, PropertyValuesString, PropertyValuesBinary, LastUpdatedDate, CommonENT.MYCTSDBSECURITY_CONNECTION);
                }
                catch (Exception ex)
                {
                    new EventsManager.EventsManager(ex, EventsManager.EventsManager.OrigenError.BaseDeDatos);
                    profileDAL.Update(UserId, PropertyNames, PropertyValuesString, PropertyValuesBinary, LastUpdatedDate, CommonENT.MYCTSDBSECURITYBACKUP_CONNECTION);
                }

                bResult = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                profileDAL = null;
            }
            return(bResult);
        }
Пример #2
0
        public IActionResult Put([FromBody] ProfileViewModel user)
        {
            if (user == null)
            {
                var error = "Arguments of request is null";
                _logger.LogInformation(error);
                return(BadRequest(new { error }));
            }
            _logger.LogInformation("Update profile of user '{login}'", user.Fio);
            var result = _dal.Update(user);

            if (result != null)
            {
                _logger.LogInformation("Update is successful");
                return(Ok(new ProfileViewModel(result)));
            }
            else
            {
                string error = "Profile cant be founded on this ID (in DB or Cache)";
                _logger.LogInformation(error);
                return(BadRequest(new { error }));
            }
        }