예제 #1
0
 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;
 }
예제 #2
0
        public UnitAlias SaveUnitAlias(UnitAlias ua)
        {
            ua = this.unitAliasRepo.SaveOrUpdate(ua);

            BackgroundJob.Enqueue <IOrganizationTasks>(x => x.LuceneUpdateUnitQueueable(ua.Unit.Id));

            return(ua);
        }
예제 #3
0
        public void DeleteUnitAlias(UnitAlias ua)
        {
            if (ua != null)
            {
                this.unitAliasRepo.Delete(ua);

                BackgroundJob.Enqueue <IOrganizationTasks>(x => x.LuceneUpdateUnitQueueable(ua.Unit.Id));
            }
        }
예제 #4
0
        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."));
        }
예제 #5
0
        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());
            }
        }
예제 #6
0
 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()));
     }
 }