Пример #1
0
 public HttpResponseMessage AddSoftware(Software software)
 {
     try
     {
         _softwareRepository.Add(software);
         HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Created);
         return(response);
     }
     catch (Exception)
     {
         HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.InternalServerError);
         return(response);
     }
 }
Пример #2
0
        /// <summary>
        /// The Save
        /// </summary>
        /// <param name="entity">The entity<see cref="Software"/></param>
        /// <returns>The <see cref="ServiceResult"/></returns>
        public ServiceResult Save(Software 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()
                });
            }
        }
 public Software Add(Software software)
 {
     return(repository.Add(software));
 }