Ejemplo n.º 1
0
        public IHttpActionResult UpdateOrder([FromBody] SalesOrder Order)
        {
            ARCOeCardEntities arcodb = new eCard.ARCOeCardEntities();
            var OrdertoUpdate        = arcodb.SalesOrders.Where(a => a.ID == Order.ID).FirstOrDefault();

            try
            {
                OrdertoUpdate.Status     = Convert.ToInt32(Order.Status);
                OrdertoUpdate.AssignedTO = Order.AssignedTO;
                arcodb.SaveChanges();

                return(Content(HttpStatusCode.OK, Order));
            }
            catch (Exception ex)
            {
                Log.Error("There was an error while updating an order", ex);
                return(Content(HttpStatusCode.InternalServerError, "There was an error while updating an order"));
            }
        }
Ejemplo n.º 2
0
        public IHttpActionResult SetUserClaimed(int UserId, int orderitemid)
        {
            ARCOeCardEntities arcodb = new eCard.ARCOeCardEntities();

            try
            {
                SalesOrder   So   = arcodb.SalesOrders.Where(a => a.ID == orderitemid).FirstOrDefault();
                PrenotesUser User = arcodb.PrenotesUsers.Where(a => a.Id == UserId).FirstOrDefault();
                So.ModifiedDate = DateTime.Now;
                So.Status       = 4;
                So.ModifiedBy   = UserId;
                So.AssignedTO   = User.Id;
                arcodb.SaveChanges();


                return(Content(HttpStatusCode.OK, "SUCCESS"));
            }
            catch (Exception ex)
            {
                Log.Error("There was an error while assigning the user.", ex);
                return(Content(HttpStatusCode.InternalServerError, "There was an error while assigning the user."));
            }
        }