public async Task <object> CreateOC(CreateOCViewModel oc) { try { if (oc.ID == 0) { var item = _mapper.Map <CreateOCViewModel, OC>(oc); item.Level = 1; await _oCRepository.AddAsync(item); } else { var item = await _oCRepository.FindByIdAsync(oc.ID); item.Name = oc.Name; } await _unitOfWork.Commit(); return(true); } catch (Exception ex) { return(false); } }