public async Task <IActionResult> CreateShelfLocation([ModelBinder(typeof(JsonModelBinder <ShelfLocationDto>))] Delta <ShelfLocationDto> shelfLocationDelta)
        {
            if (!ModelState.IsValid)
            {
                return(await Error());
            }

            var newShelfLocation = new ShelfLocation();

            shelfLocationDelta.Merge(newShelfLocation);

            await _shelfLocationRepository.InsertAsync(newShelfLocation);

            await UserActivityService.InsertActivityAsync("AddNewShelfLocation", $"Added a new shelf location (ID = {newShelfLocation.Id})", newShelfLocation);

            var newShelfLocationDto = newShelfLocation.ToDto();

            var rootObject = new ShelfLocationRootObject();

            rootObject.ShelfLocation.Add(newShelfLocationDto);

            var json = JsonFieldsSerializer.Serialize(rootObject, string.Empty);

            return(new RawJsonActionResult(json));
        }
        public ActionResult deleteShelfLocation(int ID)
        {
            ShelfLocation shelfLocation = virames <ShelfLocation>
                                          .Initialize(new ShelfLocation()).Where(x => x.ID.ToString() == ID.ToString())
                                          .Take();

            return(View(shelfLocation));
        }
Example #3
0
    public void RequestBookTitles(ShelfLocation shelfLocation, OnTitleRequestCompleted onCompletion)
    {
        throw new System.InvalidOperationException();
        // WWWForm form = new WWWForm();
        // form.AddField("hex", shelfLocation.Hex.Name);
        // form.AddField("wall", shelfLocation.Wall);
        // form.AddField("shelf", shelfLocation.Shelf);

        // StartCoroutine(WaitForRequest(TITLE_REQ_BASE_URL, form, (error, www) => {

        //  if (error) {
        //      onCompletion(emptyTitles);
        //  } else {
        //      onCompletion(www.text.Split(titleSplitArray));
        //  }
        // }));
    }
        public ActionResult newShelfLocation()
        {
            ViewBag.RecordStatus = new SelectList(Enum.GetValues(typeof(RecordStatus)));

            ViewBag.Warehouse = virames <Warehouse> .Initialize(new List <Warehouse>()).GetList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.Code + " | " + x.WarehouseName + " | " + x.Center + " | " + x.Quality
            });

            ViewBag.StorageConditionSet = virames <StorageConditionSet> .Initialize(new List <StorageConditionSet>()).GetList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.Code + " | " + x.Definition
            });

            ShelfLocation shelfLocation = new ShelfLocation();

            return(View(shelfLocation));
        }
Example #5
0
 public static ShelfLocationDto ToDto(this ShelfLocation shelfLocation)
 {
     return(shelfLocation.MapTo <ShelfLocation, ShelfLocationDto>());
 }
 public ActionResult deleteShelfLocation(ShelfLocation shelfLocation)
 {
     shelfLocation.Delete();
     return(RedirectToAction("shelfLocationDefinitions"));
 }
 public ActionResult newShelfLocation(ShelfLocation shelfLocation)
 {
     shelfLocation.Save();
     return(RedirectToAction("shelfLocationDefinitions"));
 }
Example #8
0
    private string[] ShelfLocationToTitles(ShelfLocation location)
    {
        var absoluteLocation = location.Hex.Value + relativeLocationOffset * (97 * location.Shelf + 42 * location.Wall);

        return(AbsoluteLocationToTitles(absoluteLocation));
    }
Example #9
0
 public void RequestBookTitles(ShelfLocation shelfLocation, OnTitleRequestCompleted onCompletion)
 {
     onCompletion(ShelfLocationToTitles(shelfLocation));
 }
Example #10
0
 public void RequestTitles(ShelfLocation shelf, OnTitleRequestCompleted onCompletion)
 {
     library.RequestBookTitles(shelf, onCompletion);
 }