Пример #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()));
     }
 }