public async Task <DbStatusCode> DeleteCompany(Guid Id) { try { var companyModel = await genericRepository.GetSingle(Id); if (companyModel == null) { return(DbStatusCode.NotFound); } else { genericRepository.Delete(companyModel); var changedVal = await unitOfWork.Commit(); if (changedVal > 0) { return(DbStatusCode.Deleted); } else { //Set the response status return(DbStatusCode.DbError); } } } catch (Exception ex) { //logging an exception return(DbStatusCode.Exception); } }
public async Task <DbStatusCode> DeleteConsultant(Guid Id) { try { var consultantModel = await genericRepository.Get(e => e.Id == Id).FirstOrDefaultAsync(); if (consultantModel == null) { return(DbStatusCode.NotFound); } else { genericRepository.Delete(consultantModel); var changedVal = await unitOfWork.Commit(); if (changedVal > 0) { return(DbStatusCode.Deleted); } else { //Set the response status return(DbStatusCode.DbError); } } } catch (Exception ex) { //logging an exception return(DbStatusCode.Exception); } }