示例#1
0
        public IActionResult Modify([FromBody] Bucket item)
        {
            try
            {
                if (item.PostId.HasValue)
                {
                    Bucket bucket = postRepository.GetBucketById(item.PostId.Value, item.UserId).FirstOrDefault();

                    if (bucket != null)
                    {
                        item.Id      = bucket.Id;
                        item.Created = bucket.Created;
                    }

                    postRepository.AddOrUpdateBucket(item);
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.GetBaseException().Message));
            }
            return(Ok(item));
        }