public JsonResult UpdateLabel(ComponentLabelDTO dto) { ComponentLabelDTO result = null; try { var entity = UnitOfWork.TblLabel.Get(dto.id); if (entity != null) { entity.lbl_comp_id = dto.lbl_comp_id; entity.lbl_lang_id = dto.lbl_lang_id; entity.lbl_desc = dto.lbl_desc; entity.tbl_lang = null; entity.tbl_comp = null; UnitOfWork.Save(); result = Mapper.Map <ComponentLabelDTO>(entity); } } catch (Exception ex) { _logger.Error(ex); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult AddLabel(ComponentLabelDTO dto) { ComponentLabelDTO result = null; try { var entity = Mapper.Map <tbl_lbl>(dto); if (entity != null) { entity.tbl_lang = null; entity.tbl_comp = null; UnitOfWork.TblLabel.Add(entity); UnitOfWork.Save(); result = Mapper.Map <ComponentLabelDTO>(entity); } } catch (Exception ex) { _logger.Error(ex); } return(Json(result, JsonRequestBehavior.AllowGet)); }