Ejemplo n.º 1
0
        public ServerResponse<BookContent> SaveBookContent(string personId, string personName, string userType, string bookId, int pageNo, [FromBody]PageContent content)
        {
            ServerResponse<BookContent> result = new ServerResponse<BookContent>();
            BookContent obj = new BookContent()
            {
                BookId = bookId,
                PageNo = pageNo,
                Title = content.Title,
                Description = content.Description,
                ImageUrl = content.ImageUrl,
                LinkUrl = content.LinkUrl,
                CreateTime = DateTime.Now,
                ContentType = content.ContentType
            };
            try
            {
                if (bookProvider.SaveContent(obj))
                {
                    result.Status = ResponseStatus.Success;
                    result.Message = DAF.Core.Resources.Locale(o => o.SaveSuccessfully);
                    result.Data = obj;
                }
                else
                {
                    result.Status = ResponseStatus.Failed;
                    result.Message = DAF.Core.Resources.Locale(o => o.SaveFailure);
                }
            }
            catch (Exception ex)
            {
                result.Status = ResponseStatus.Exception;
                result.Message = ex.Message;
            }

            return result;
        }
Ejemplo n.º 2
0
 public bool SaveContent(BookContent content)
 {
     if (string.IsNullOrEmpty(content.ContentId))
     {
         content.ContentId = generator.NewId();
     }
     bool result = repoBookContent.Save(o => o.ContentId == content.ContentId, content);
     return result;
 }