Example #1
0
        public HttpResponseMessage AddAsset(Models.ExternalAddAssetViewModel model)
        {
            BO.AssetProcess assetProcess = new BO.AssetProcess();
            if (null != model)
            {
                //EmployeeID must be tracked
                if (model.EmployeeID != 0)
                {
                    if (assetProcess.AddNewAsset(model) == ReturnValues.SUCCESS)
                    {
                        Helpers.Logger.AddToAuditTrail(Logger.UserAction.ADD_ASSET, model.EmployeeID, String.Format("SUCCESSFUL. New Asset Tag {0}", model.AssetTag));
                        return(ReturnMessages.RESPONSE_CREATED());
                    }
                }
            }

            Helpers.Logger.AddToAuditTrail(Logger.UserAction.ADD_ASSET, model.EmployeeID, String.Format("NOT SUCCESSFUL. Failed Asset Tag {0}", model.AssetTag));

            return(ReturnMessages.RESPONSE_NOTSUCCESSFUL());
        }
Example #2
0
        public int AddNewAsset(Models.ExternalAddAssetViewModel model)
        {
            using (var db = new FASTDBEntities())
            {
                FixAsset newAsset = new FixAsset();
                newAsset = model.GetNewFixAssetData();


                db.FixAssets.Add(newAsset);

                int result = db.SaveChanges();

                if (result > 0)
                {
                    return(ReturnValues.SUCCESS);
                }
                else
                {
                    return(ReturnValues.FAILED);
                }
            }
        }