Esempio n. 1
0
        internal Review Edit(Review updatedRev)
        {
            Review data = Get(updatedRev.Id);

            updatedRev.Title        = updatedRev.Title != null ? updatedRev.Title : data.Title;
            updatedRev.Rating       = updatedRev.Rating != null ? updatedRev.Rating : data.Rating;
            updatedRev.Date         = updatedRev.Date != null ? updatedRev.Date : data.Date;
            updatedRev.Body         = updatedRev.Body != null ? updatedRev.Body : data.Body;
            updatedRev.ContractorId = updatedRev.ContractorId != null ? updatedRev.ContractorId : data.ContractorId;
            return(_repo.Edit(updatedRev));
        }
Esempio n. 2
0
        internal Review Edit(Review editData, string userId)
        {
            Review original = Get(editData.Id);

            if (original.OwnerId != userId)
            {
                throw new Exception("You cannot edit something you did not create");
            }
            editData.Body  = editData.Body == null ? original.Body : editData.Body;
            editData.Title = editData.Title == null ? original.Title : editData.Title;
            return(_revsrepo.Edit(editData));
        }
        internal Review Edit(Review update)
        {
            var original = GetById(update.Id);

            if (original == null)
            {
                throw new Exception("Bad Request");
            }
            update.ProductId = original.ProductId;
            update.Title     = update.Title != null ? update.Title : original.Title;
            update.Body      = update.Body != null ? update.Body : original.Body;

            return(_repo.Edit(update));
        }
        internal Review Edit(Review update)
        {
            var original = GetById(update.Id);

            if (original == null)
            {
                throw new Exception("Bad Request");
            }
            update.ContractorId = original.ContractorId;
            update.Title        = update.Title != null ? update.Title : original.Title;
            update.Body         = update.Body != null ? update.Body : original.Body;
            update.DateStamp    = update.DateStamp != null ? update.DateStamp : original.DateStamp;

            return(_repo.Edit(update));
        }