Example #1
0
 public IActionResult Post([FromBody] AttachmentExpirySettingsModel request)
 {
     try
     {
         var response = this.m_ExpirySettingsService.Add(request);
         return(new OkObjectResult(response));
     }
     catch (Exception ex)
     {
         return(new BadRequestObjectResult(ex));
     }
 }
        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public AttachmentExpirySettingsModel Add(AttachmentExpirySettingsModel entity)
        {
            try
            {
                var model = new AttachmentExpirySettings()
                {
                    AttachmentId   = entity.AttachmentId,
                    DeletionDate   = entity.DeletionDate,
                    DownloadsLimit = entity.DownloadsLimit,
                    ExpiryDate     = entity.ExpiryDate
                };

                this.m_AttachmentExpirySettingsRepository.Add(model);
                return(entity);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.StackTrace);
            }
        }