public async Task <ApiResponse <ChecklistTypeCheckPoint> > CreateChecklistTypeCheckPoint(ChecklistTypeCheckPointDto checklisttypeCheckPoint) { try { return(await _checklisttypeCheckPointServices.CreateChecklistTypeCheckPoint(checklisttypeCheckPoint)); } catch (Exception ex) { return(new ApiResponse <ChecklistTypeCheckPoint>() { Success = false, Errors = new List <string>() { ex.Message } }); } }
public async Task <ApiResponse <ChecklistTypeCheckPoint> > CreateChecklistTypeCheckPoint(ChecklistTypeCheckPointDto checklisttypeCheckPointDto) { var response = new ApiResponse <ChecklistTypeCheckPoint>(); try { //check checklisttype Exists var isExistChecklistTypeCheckPoint = await _checklisttypeCheckPointRepository.CountAsync(i => i.ChecklistTypeId == checklisttypeCheckPointDto.ChecklistTypeId && i.CheckPointId == checklisttypeCheckPointDto.CheckPointId); if (isExistChecklistTypeCheckPoint != 0) { response.Success = false; response.Errors.Add("ChecklistTypeCheckPoint Already Exists"); return(response); } var id = Guid.NewGuid(); //create new checklisttype var checklisttypeCheckPoint = Mapper.Map <ChecklistTypeCheckPoint>(checklisttypeCheckPointDto); checklisttypeCheckPoint.Id = id; //checklisttype.CreatedBy = checklisttype.Id; checklisttypeCheckPoint.CreatedDate = DateTime.Now; //checklisttype.Roles = checklisttypeRoles; checklisttypeCheckPoint.IsActive = true; await _checklisttypeCheckPointRepository.AddAsyn(checklisttypeCheckPoint); response.Success = true; } catch (Exception ex) { response.Success = false; response.Errors.Add(ex.Message); } return(response); }