public UnitAliasViewModel(UnitAlias ua) { this.Id = ua.Id; this.UnitId = ua.Unit.Id; this.UnitName = ua.UnitName; this.Archive = ua.Archive; this.Notes = ua.Notes; }
public UnitAlias SaveUnitAlias(UnitAlias ua) { ua = this.unitAliasRepo.SaveOrUpdate(ua); BackgroundJob.Enqueue <IOrganizationTasks>(x => x.LuceneUpdateUnitQueueable(ua.Unit.Id)); return(ua); }
public void DeleteUnitAlias(UnitAlias ua) { if (ua != null) { this.unitAliasRepo.Delete(ua); BackgroundJob.Enqueue <IOrganizationTasks>(x => x.LuceneUpdateUnitQueueable(ua.Unit.Id)); } }
public JsonNetResult Delete(int id) { UnitAlias alias = this.orgTasks.GetUnitAlias(id); if (alias != null) { this.orgTasks.DeleteUnitAlias(alias); Response.StatusCode = (int)HttpStatusCode.OK; return(JsonNet("Unit alias successfully removed.")); } Response.StatusCode = (int)HttpStatusCode.NotFound; return(JsonNet("Unit alias not found.")); }
public ActionResult Edit(int id) { UnitAlias alias = this.orgTasks.GetUnitAlias(id); if (alias != null) { UnitAliasViewModel vm = new UnitAliasViewModel(alias); return(View(vm)); } else { return(new HttpNotFoundResult()); } }
public JsonNetResult Edit(UnitAliasViewModel vm) { if (ModelState.IsValid) { UnitAlias alias = this.orgTasks.GetUnitAlias(vm.Id); if (alias != null) { Mapper.Map <UnitAliasViewModel, UnitAlias>(vm, alias); alias = this.orgTasks.SaveUnitAlias(alias); return(JsonNet(string.Empty)); } Response.StatusCode = (int)HttpStatusCode.NotFound; return(JsonNet("Unit alias not found.")); } else { return(JsonNet(this.GetErrorsForJson())); } }