public async Task Update(int id, VinculationType vType) { var existingVType = await _vinculationTypeRepository.FindById(id); existingVType.Code = vType.Code; existingVType.Type = vType.Type; await _vinculationTypeRepository.Update(existingVType); }
public async Task <ActionResult> Create(VinculationTypeViewModel vinculationTypeViewModel) { var existingCampus = await _vinculationTypeService.FindByCode(vinculationTypeViewModel.Code); if (existingCampus == null) { var vType = new VinculationType { Code = vinculationTypeViewModel.Code, Type = vinculationTypeViewModel.Type }; await _vinculationTypeService.Create(vType); return(Ok()); } else { return(BadRequest("Ya existe un tipo de vinculaciĆ³n con este codigo")); } }
public async Task <ActionResult> Edit(int id, VinculationTypeViewModel vinculationTypeViewModel) { var temp = await _vinculationTypeService.FindById(id); var existingVType = await _vinculationTypeService.FindByCode(vinculationTypeViewModel.Code); if (existingVType == null || temp.Code == existingVType.Code) { var vType = new VinculationType { Code = vinculationTypeViewModel.Code, Type = vinculationTypeViewModel.Type }; await _vinculationTypeService.Update(id, vType); return(Ok()); } else { return(BadRequest("Ya existe un tipo de vinculaciĆ³n con este codigo")); } }
public async Task Create(VinculationType vType) { await _vinculationTypeRepository.Add(vType); }