internal async Task <bool> UpdateDeliveryStatus(deliverystatus deliveryStatus)
        {
            var res = await client.PutAsync <deliverystatus>("UpdateDeliveryStatus", deliveryStatus.Id, deliveryStatus);

            if (res != default(deliverystatus))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <IHttpActionResult> UpdateDeliveryStatus(deliverystatus obj)
        {
            var UserManager = HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>();
            var user        = await UserManager.FindByNameAsync(User.Identity.Name);

            obj.UserID = user.Id;
            try
            {
                return(Ok(context.UpdateDeliveryStatus(obj)));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.NotModified, ex.Message));
            }
        }
示例#3
0
 public deliverystatus UpdateDeliveryStatus(deliverystatus obj)
 {
     using (var db = new OcphDbContext())
     {
         var isUpdated = db.DeliveryStatusses.Update(O => new { O.Description, O.IsSignIn, O.Phone, O.ReciveDate, O.ReciveName, O.UserID },
                                                     obj, O => O.Id == obj.Id && O.PenjualanId == obj.PenjualanId);
         if (isUpdated)
         {
             return(obj);
         }
         else
         {
             throw new SystemException("Tidak Tersimpan");
         }
     }
 }
示例#4
0
        public deliverystatus UpdateDeliveryStatusBySTT(int id, deliverystatus obj)
        {
            try
            {
                using (var db = new OcphDbContext())
                {
                    var res = db.Penjualans.Where(O => O.STT == id).FirstOrDefault();
                    if (res != null)
                    {
                        obj.PenjualanId = res.Id;

                        var deliveryId = db.DeliveryStatusses.Where(O => O.PenjualanId == res.Id).FirstOrDefault().Id;
                        if (deliveryId <= 0)
                        {
                            throw new SystemException("Delivery Status Tidak Ditemukan");
                        }
                        else
                        {
                            obj.Id = deliveryId;
                        }

                        var isUpdated = db.DeliveryStatusses.Update(O => new { O.Description, O.IsSignIn, O.Phone, O.ReciveDate, O.ReciveName, O.UserID }, obj, O => O.Id == obj.Id && O.PenjualanId == obj.PenjualanId);
                        if (isUpdated)
                        {
                            return(obj);
                        }
                        else
                        {
                            throw new SystemException("Tidak Tersimpan");
                        }
                    }
                    else
                    {
                        throw new SystemException("STT Tidak Ditemukan");
                    }
                }
            }
            catch (Exception ex)
            {
                throw new SystemException(ex.Message);
            }
        }