// DELETE: api/Manager/5 public void Delete(int id) { Manager e = new Manager(); e.mcid = id; ManagerRepository.Delete(id); }
private void MtEmployeeDelete_Click(object sender, EventArgs e) { if (this.dgvManager.SelectedRows.Count != 1) { MessageBox.Show("Please Select A Row First"); return; } if (MessageBox.Show("Are You Sure?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.No) { return; } string appid = this.dgvManager.CurrentRow.Cells["appid"].Value.ToString(); bool decision = mrepo.Delete(appid); if (decision) { MessageBox.Show("Delete Confirmed."); this.PopulateGridView(); } else { MessageBox.Show("Invalid Id."); } }
public async Task <IHttpActionResult> Delete(int id) { Manager manager = await managerRepository.FindByCondition(item => item.Id == id).FirstOrDefaultAsync(); if (manager == null) { return(Content(HttpStatusCode.NotFound, "Manager not found")); } User user = await userRepository.FindByCondition(item => item.Id == manager.UserId).FirstOrDefaultAsync(); if (user == null) { return(Content(HttpStatusCode.NotFound, "User not found")); } userRepository.Delete(user); managerRepository.Delete(manager); await db.SaveChangesAsync(); return(Ok()); }
public async Task <Operate> DeleteById(int id) { var result = new Operate(); try { using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { var manager = await _managerRepository.GetById(id); if (manager == null) { result.Status = -2; result.Message = "Manager does not exist"; return(result); } //check wether customer is using mananger var customer = await _customerRepository.GetByManagerId(id); if (customer != null) { result.Status = -3; result.Message = $"Manager is used by {customer.CompanyName}"; return(result); } await _managerRepository.Delete(manager); scope.Complete(); } } catch (Exception ex) { result.Status = -1; result.Message = ex.Message; Logger.WriteErrorLog("ManagerService", "DeleteById", ex); } return(result); }
public bool DeleteUser(int Id, string FIO, string position) { switch (position) { case "admin": AdmininRepository _ad = new AdmininRepository(); ComandRepository _com = new ComandRepository(); if (_com.GetObject(Id) != null) { return(false); } _ad.Delete(Id); _ad.Save(); return(true); case "employer": EmployeeRepository _em = new EmployeeRepository(); if (_em.GetObject(Id).comandId != null) { return(false); } _em.Delete(Id); _em.Save(); return(true); case "manager": ManagerRepository _me = new ManagerRepository(); if (_me.GetObject(Id).comandId != null) { return(false); } _me.Delete(Id); _me.Save(); return(true); default: return(false); } }
/// <summary> /// Delete Manager /// </summary> /// <param name="id"></param> public void Delete(long id) { ManagerRepository.Delete(id); }
public void DeleteManager(int ManagerId) { var Manager = ManagerRepository.GetById(ManagerId); ManagerRepository.Delete(Manager); }
public override void Remove(ManagerUser manager) { managerRepository.Delete(manager.id); }
public void Delete(Manager entity) => _managerRepository.Delete(entity);