public IResult Update(int id, Allergies entity)
        {
            var allergyCheck = CheckAllergyExist(id);

            if (!allergyCheck.IsSuccess)
            {
                return(new ErrorResult(allergyCheck.Message));
            }
            _allergyRepository.Update(entity);
            return(new SuccessResult(Messages.AllergyUpdated));
        }
        public bool SaveOrUpdate(Allergy allergy)
        {
            var oldItem = allergyRepository.GetAllergyByTitle(allergy.Title);

            if (allergy.AllergyId > 0)
            {
                if (oldItem != null && oldItem.AllergyId != allergy.AllergyId)
                {
                    return(false);
                }
                allergyRepository.Update(allergy);
            }
            else
            {
                if (oldItem != null)
                {
                    return(false);
                }
                allergyRepository.Add(allergy);
            }

            allergyRepository.SaveChanges();
            return(true);
        }
 public bool Update(Allergy entity)
 {
     return(allergyRepository.Update(entity));
 }