Exemple #1
0
        public async Task <IActionResult> Post([FromBody] OrganizacionaCelina organizacionaCelina)
        {
            if (!ModelState.IsValid)
            {
                return(Fail(ModelState));
            }

            _unitOfWork.OrganizacioneCeline.Add(organizacionaCelina);
            await _unitOfWork.Complete();

            return(Success(organizacionaCelina));
        }
Exemple #2
0
        public async Task <IActionResult> Put([FromRoute] int id, [FromBody] OrganizacionaCelina organinizaCelinaEdit)
        {
            if (!ModelState.IsValid)
            {
                return(Fail(ModelState));
            }

            var organizacionaCelina = await _unitOfWork.OrganizacioneCeline.Get(id);

            if (organizacionaCelina == null)
            {
                return(Fail("Not Found"));
            }

            organizacionaCelina.Naziv = organinizaCelinaEdit.Naziv;
            await _unitOfWork.Complete();

            return(Success(organizacionaCelina));
        }