public ActionResult Entry(AssetEntryVm assetEntryVm)
        {
            ViewBag.orglist = generalCategoryManager.GetAll();

            ViewBag.assetlist = assetManager.GetSome(5);

            var assetCodeCheck = assetManager.GetAll().Where(c => c.Code == assetEntryVm.Code).ToList();

            if (!ModelState.IsValid)
            {
                return(View(assetEntryVm));
            }
            else if (assetCodeCheck.Count > 0)
            {
                ViewBag.msg = "Code Already Exist";
                return(View(assetEntryVm));
            }
            else
            {
                var assetEntry = Mapper.Map <Asset>(assetEntryVm);
                assetEntry.Registered   = false;
                assetEntry.Organization = Session["organizationName"].ToString();
                assetManager.Add(assetEntry);

                //var newAssetEntry = Mapper.Map<NewAsset>(assetEntryVm);
                //newAssetManager.Add(newAssetEntry);

                ModelState.Clear();
                return(RedirectToAction("Entry", new { success = "true" }));
            }
        }
        public ActionResult Create([Bind(Include = "Id,Name,Description,GeneralCateforyId,CateforyId,ModelId,Price,Qty,SerialCode")] Asset asset)
        {
            if (ModelState.IsValid)
            {
                _assetManager.Add(asset);
                return(RedirectToAction("Index"));
            }

            ViewBag.ModelId = new SelectList(_modelManager.GetAll(), "Id", "Name", asset.ModelId);
            return(View(asset));
        }
 public IActionResult Create(Asset asset)
 {
     try
     {
         // TODO: Add insert logic here
         _assetManager.Add(asset);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
        public async Task <IActionResult> Add(string id, int value)
        {
            try
            {
                var asset = _manager.Add(id, value);
                await _webhookPublisher.PublishAsync("Assets.AssetUpdated", asset.Id.ToString(), asset.Name).ConfigureAwait(false);

                return(await base.PutEntity(id, asset));
            }
            catch (Exception ex)
            {
                return(ex.GetActionResult());
            }
        }
 public void Add()
 {
     AssetManager.Add(Asset, AssetGroup);
 }