Esempio n. 1
0
 public int CreateOrUpdate(RatingBllModel rating)
 {
     if (rating != null)
     {
         var field = _floraDbContext.Fields.FirstOrDefault(x => rating.FieldId == x.Id || rating.Field.Name.Equals(x.Name));
         if (field == null)
         {
             throw new KeyNotFoundException();
         }
         else
         {
             rating.FieldId = field.Id;
             return(Create(rating));
         }
     }
     else
     {
         throw new KeyNotFoundException();
     }
 }
Esempio n. 2
0
        public IActionResult CreateOrUpdate([FromBody] RatingBllModel rating)
        {
            var res = _ratingRepository.CreateOrUpdate(rating);

            return(Ok(res));
        }
Esempio n. 3
0
 private int Update(RatingBllModel rating, RatingEntity entity)
 {
     return(_floraDbContext.SaveChanges());
 }
Esempio n. 4
0
 private int Create(RatingBllModel rating)
 {
     return(_floraDbContext.SaveChanges());
 }