public BusinessUnitDetail GetBUDetailsById(int id)
 {
     try
     {
         BusinessUnitDetail result = new BusinessUnitDetail();
         var bu = _context.BusinessUnit.Where(x => x.Id == id && x.IsDelete == false).FirstOrDefault();
         result = _mapper.Map <BusinessUnitDetail>(bu);
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public IActionResult Post([FromBody] BusinessUnitDetail BusinessUnitDetail)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest());
         }
         return(Ok(_unitOfWork.BusinessUnitDetail.Insert(BusinessUnitDetail)));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, "Internal server error: " + ex.Message));
     }
 }
 public IActionResult Put([FromBody] BusinessUnitDetail BusinessUnitDetail)
 {
     try
     {
         if (ModelState.IsValid && _unitOfWork.BusinessUnitDetail.Update(BusinessUnitDetail))
         {
             return(Ok(new { Message = "Línea de negocio se ha actualizado" }));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         return(StatusCode(500, "Internal server error: " + ex.Message));
     }
 }
Beispiel #4
0
        public BusinessUnitDetail GetBUDetailsById(int id)
        {
            BusinessUnitDetail buDetail = _buRepository.GetBUDetailsById(id);

            return(buDetail);
        }