public IActionResult AddTypeOfReaction([FromHeader(Name = "CommunicationKey")] string key, [FromBody] TypeOfReactionCreateDto typeOfReaction) { TypeOfReaction type = mapper.Map <TypeOfReaction>(typeOfReaction); try { typeOfReactionRepository.AddTypeOfReaction(type); typeOfReactionRepository.SaveChanges(); logger.Log(LogLevel.Information, contextAccessor.HttpContext.TraceIdentifier, "", String.Format("Successfully created new type of reaction with ID {0} in database", type.TypeOfReactionID), null); return(StatusCode(StatusCodes.Status201Created, "Type of reaction is successfully created!")); } catch (Exception ex) { logger.Log(LogLevel.Error, contextAccessor.HttpContext.TraceIdentifier, "", String.Format("Reaction with ID {0} not created, message: {1}", type.TypeOfReactionID, ex.Message), null); return(StatusCode(StatusCodes.Status500InternalServerError, "Create error")); } }
public void UpdateTypeOfReaction(TypeOfReaction typeOfReaction) { //ova metoda se nece pozvati }
public void AddTypeOfReaction(TypeOfReaction typeOfReaction) { contextDB.Add(typeOfReaction); }