Пример #1
0
 /// <summary>
 /// The Delete
 /// </summary>
 /// <param name="entity">The entity<see cref="SR_role"/></param>
 /// <returns>The <see cref="ServiceResult"/></returns>
 public ServiceResult Delete(SR_role entity)
 {
     try
     {
         _repository.Delete(entity);
         return(new ServiceResult(true));
     }
     catch (Exception ex)
     {
         return(new ServiceResult(false)
         {
             Error = ex.ToString()
         });
     }
 }
Пример #2
0
        /// <summary>
        /// The Save
        /// </summary>
        /// <param name="entity">The entity<see cref="SR_role"/></param>
        /// <returns>The <see cref="ServiceResult"/></returns>
        public ServiceResult Save(SR_role entity)
        {
            try
            {
                if (entity.Identifier == 0)
                {
                    _repository.Add(entity);
                }
                else
                {
                    _repository.Update(entity);
                }

                return(new ServiceResult(true));
            }
            catch (Exception ex)
            {
                return(new ServiceResult(false)
                {
                    Error = ex.ToString()
                });
            }
        }