コード例 #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);
        }
コード例 #2
0
 public ActionResult SaveMasterAllergyReaction(MasterAllergyReactionDTO masterAllergyReactionDTO)
 {
     return(Ok(_masterAllergyReactionService.AddUpdateMasterAllergyReaction(masterAllergyReactionDTO, GetToken(HttpContext))));
 }