public int CreateAssetDetails(AssetDetailsEntities AssetDetailEntities)
        {
            //DateTime? issuedate = null;
            //DateTime? returndate = null;
            var issuedate  = (DateTime?)null;
            var returndate = (DateTime?)null;

            if (AssetDetailEntities.ISSUEDDATE != null)
            {
                issuedate = DateTime.ParseExact(AssetDetailEntities.ISSUEDDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            if (AssetDetailEntities.RETURNEDDATE != null)
            {
                returndate = DateTime.ParseExact(AssetDetailEntities.RETURNEDDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            if (AssetDetailEntities != null)
            {
                var AssetDetails = new TBL_EMP_ASSETDETAILS
                {
                    EMPLOYEE_ID   = AssetDetailEntities.EMPLOYEE_ID,
                    ASSET_NAME    = AssetDetailEntities.ASSET_NAME,
                    ASSET_CODE    = AssetDetailEntities.ASSET_CODE,
                    ISSUED_DATE   = issuedate,
                    RETURNED_DATE = returndate,
                    ISSUEDBY      = AssetDetailEntities.ISSUEDBY,
                    RETURNEDTO    = AssetDetailEntities.RETURNEDTO,
                    ASSET_STATUS  = AssetDetailEntities.ASSET_STATUS
                };
                _UOW.EMP_ASSETDETAILSRepository.Insert(AssetDetails);
                _UOW.Save();
            }

            return(Convert.ToInt32(AssetDetailEntities.ID));
        }
Example #2
0
 // PUT api/assetdetails/5
 public bool Put(int id, [FromBody] AssetDetailsEntities item)
 {
     if (id > 0)
     {
         return(_AssetDetails.UpdateAssetDetails(id, item));
     }
     return(false);
 }
Example #3
0
        public async Task <ActionResult> Assetdtlsedit(int id, AssetDetailsEntities bie)
        {
            HttpResponseMessage responseMessageemploymentdetails = await client.PutAsJsonAsync(url + "assetdetails/" + id, bie);

            if (responseMessageemploymentdetails.IsSuccessStatusCode)
            {
                TempData["sucmsgupdate"] = "saved";
                return(RedirectToAction("Index", new RouteValueDictionary(
                                            new { controller = "Assetissue", action = "Index", id = Convert.ToInt32(Session["urladid"]) })));
            }
            return(Json("_Asset"));
        }
Example #4
0
        public async Task <ActionResult> Assetdtlscreate(AssetDetailsEntities bie)
        {
            bie.EMPLOYEE_ID = Convert.ToInt32(Session["urladid"]);
            //if (ModelState.IsValid)
            //{

            HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url + "assetdetails", bie);

            if (responseMessage.IsSuccessStatusCode)
            {
                TempData["sucsmsg"] = "saved";
                //return RedirectToAction("Index");
                return(RedirectToAction("Index", new RouteValueDictionary(
                                            new { controller = "Assetissue", action = "Index", id = Convert.ToInt32(Session["urladid"]) })));
            }
            return(Json("_Asset"));
        }
        public bool UpdateAssetDetails(int AssetDetailsId, AssetDetailsEntities AssetDetailEntities)
        {
            var issuedate  = (DateTime?)null;
            var returndate = (DateTime?)null;

            if (AssetDetailEntities.ISSUEDDATE != null)
            {
                issuedate = DateTime.ParseExact(AssetDetailEntities.ISSUEDDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            if (AssetDetailEntities.RETURNEDDATE != null)
            {
                returndate = DateTime.ParseExact(AssetDetailEntities.RETURNEDDATE, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            var success = false;

            if (AssetDetailEntities != null)
            {
                //using (var scope = new TransactionScope())
                //{
                var AssetDetails = _UOW.EMP_ASSETDETAILSRepository.GetByID(AssetDetailsId);
                if (AssetDetails != null)
                {
                    if (AssetDetailEntities.EMPLOYEE_ID != null)
                    {
                        AssetDetails.EMPLOYEE_ID = AssetDetailEntities.EMPLOYEE_ID;
                    }

                    if (AssetDetailEntities.ASSET_NAME != "" && AssetDetailEntities.ASSET_NAME != null)
                    {
                        AssetDetails.ASSET_NAME = AssetDetailEntities.ASSET_NAME;
                    }
                    if (AssetDetailEntities.ASSET_CODE != "" && AssetDetailEntities.ASSET_CODE != null)
                    {
                        AssetDetails.ASSET_CODE = AssetDetailEntities.ASSET_CODE;
                    }
                    if (AssetDetailEntities.ISSUEDDATE != null)
                    {
                        AssetDetails.ISSUED_DATE = issuedate;
                    }
                    if (AssetDetailEntities.RETURNEDDATE != null)
                    {
                        AssetDetails.RETURNED_DATE = returndate;
                    }
                    if (AssetDetailEntities.ISSUEDBY != "" && AssetDetailEntities.ISSUEDBY != null)
                    {
                        AssetDetails.ISSUEDBY = AssetDetailEntities.ISSUEDBY;
                    }
                    if (AssetDetailEntities.RETURNEDTO != "" && AssetDetailEntities.RETURNEDTO != null)
                    {
                        AssetDetails.RETURNEDTO = AssetDetailEntities.RETURNEDTO;
                    }

                    if (AssetDetailEntities.ASSET_STATUS != "" && AssetDetailEntities.ASSET_STATUS != null)
                    {
                        AssetDetails.ASSET_STATUS = AssetDetailEntities.ASSET_STATUS;
                    }
                    _UOW.EMP_ASSETDETAILSRepository.Update(AssetDetails);
                    _UOW.Save();
                    //scope.Complete();
                    success = true;
                    //}
                }
            }
            return(success);
        }
Example #6
0
 // POST api/assetdetails
 public int Post([FromBody] AssetDetailsEntities item)
 {
     return(_AssetDetails.CreateAssetDetails(item));
 }