Ejemplo n.º 1
0
        public JsonModel AddUpdateMasterAllergyReaction(MasterAllergyReactionDTO masterAllergyReactionDTO, TokenModel token)
        {
            JsonModel Result = new JsonModel()
            {
                data       = false,
                Message    = StatusMessage.Success,
                StatusCode = (int)HttpStatusCodes.OK
            };
            MasterAllergiesReaction masterAllergiesReactionEntity = null;
            DateTime CurrentDate = DateTime.UtcNow;

            if (masterAllergyReactionDTO.Id == 0 || masterAllergyReactionDTO.Id == null)
            {
                masterAllergiesReactionEntity = _mapper.Map <MasterAllergiesReaction>(masterAllergyReactionDTO);
                masterAllergiesReactionEntity.OrganizationId = 2; // token.OrganizationID;
                masterAllergiesReactionEntity.CreatedBy      = 2; // token.UserID;
                masterAllergiesReactionEntity.CreatedDate    = CurrentDate;
                masterAllergiesReactionEntity.IsActive       = true;
                masterAllergiesReactionEntity.IsDeleted      = false;
                _masterAllergyReactionRepository.Create(masterAllergiesReactionEntity);
                _masterAllergyReactionRepository.SaveChanges();
            }

            else
            {
                MasterAllergiesReaction masterAllergiesReaction = _masterAllergyReactionRepository.Get(l => l.Id == masterAllergyReactionDTO.Id && l.OrganizationId == 2); // token.OrganizationID);
                masterAllergiesReaction.UpdatedBy    = 2;                                                                                                                  // token.UserID;
                masterAllergiesReaction.UpdatedDate  = CurrentDate;
                masterAllergiesReaction.ReactionType = masterAllergyReactionDTO.ReactionType;
                _masterAllergyReactionRepository.Update(masterAllergiesReaction);
                _masterAllergyReactionRepository.SaveChanges();
            }

            return(Result);
        }
Ejemplo n.º 2
0
        public bool DeleteMasterAllergyReaction(int Id, TokenModel token)
        {
            MasterAllergiesReaction masterAllergiesReactionEntity = _masterAllergyReactionRepository.Get(l => l.Id == Id && l.OrganizationId == 2);// token.OrganizationID);

            masterAllergiesReactionEntity.IsDeleted   = true;
            masterAllergiesReactionEntity.IsActive    = false;
            masterAllergiesReactionEntity.DeletedBy   = 2;// token.UserID;
            masterAllergiesReactionEntity.DeletedDate = DateTime.UtcNow;
            _masterAllergyReactionRepository.SaveChanges();

            return(true);
        }