public Loaning(LoaningVM loaningVM)
 {
     this.Date_Loaning = loaningVM.Date_Loaning;
     this.Date_Return  = loaningVM.Date_Return;
     this.Quantity     = loaningVM.Quantity;
     this.CreateDate   = DateTimeOffset.Now.ToLocalTime();
 }
 public void Update(int id, LoaningVM loaningVM)
 {
     this.Date_Loaning = loaningVM.Date_Loaning;
     this.Date_Return  = loaningVM.Date_Return;
     this.Quantity     = loaningVM.Quantity;
     this.UpdateDate   = DateTimeOffset.Now.ToLocalTime();
 }
 public bool Insert(LoaningVM loaningVM)
 {
     if (string.IsNullOrWhiteSpace(Convert.ToString(loaningVM.User_Id)))
     {
         return(status);
     }
     else if (string.IsNullOrWhiteSpace(Convert.ToString(loaningVM.Date_Loaning)))
     {
         return(status);
     }
     else if (string.IsNullOrWhiteSpace(Convert.ToString(loaningVM.Date_Return)))
     {
         return(status);
     }
     else if (string.IsNullOrWhiteSpace(Convert.ToString(loaningVM.Item_Id)))
     {
         return(status);
     }
     else if (string.IsNullOrWhiteSpace(Convert.ToString(loaningVM.TypeItem_Id)))
     {
         return(status);
     }
     else
     {
         return(iLoaningRepository.Insert(loaningVM));
     }
 }
        public bool Insert(LoaningVM loaningVM)
        {
            var push = new Loaning(loaningVM);
            var get  = myContext.Item.Find(loaningVM.Item_Id);

            if (get != null)
            {
                push.Item = get;
                myContext.Loaning.Add(push);
                var result = myContext.SaveChanges();
                if (result > 0)
                {
                    status = true;
                    return(status);
                }
                else
                {
                    return(status);
                }
            }
            else
            {
                return(status);
            }
        }
Exemple #5
0
 public void Update(int id, LoaningVM loaningVM)
 {
     this.Id          = id;
     this.DateLoaning = loaningVM.DateLoaning;
     this.DateReturn  = loaningVM.DateReturn;
     this.Quantity    = loaningVM.Quantity;
     this.Status      = loaningVM.Status;
     this.UpdateDate  = DateTimeOffset.Now.ToLocalTime();
 }
Exemple #6
0
 public Loaning(LoaningVM loaningVM)
 {
     this.Date_Loaning = loaningVM.Date_Loaning;
     this.Date_Return  = loaningVM.Date_Return;
     this.Name_User    = loaningVM.Name_User;
     this.Name_Item    = loaningVM.Name_Item;
     this.Quantity     = loaningVM.Quantity;
     this.Status       = loaningVM.Status;
     this.CreateDate   = DateTimeOffset.Now.ToLocalTime();
 }
Exemple #7
0
 public void Update(int id, LoaningVM loaningVM)
 {
     this.Id           = loaningVM.Id;
     this.Date_Loaning = loaningVM.Date_Loaning;
     this.Date_Return  = loaningVM.Date_Return;
     this.Name_User    = loaningVM.Name_User;
     this.Name_Item    = loaningVM.Name_Item;
     this.Quantity     = loaningVM.Quantity;
     this.Status       = loaningVM.Status;
     this.UpdateDate   = DateTimeOffset.Now.ToLocalTime();
 }
Exemple #8
0
        // POST: api/Loanings
        public HttpResponseMessage InsertLoaning(LoaningVM loaningVM)
        {
            var message = Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request");
            var result  = iLoaningService.Insert(loaningVM);

            if (result)
            {
                message = Request.CreateResponse(HttpStatusCode.Created);
            }
            return(message);
        }
Exemple #9
0
        // PUT: api/Loanings/5
        public HttpResponseMessage UpdateLoaning(int id, LoaningVM loaningVM)
        {
            var message = Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request");
            var result  = iLoaningService.Update(id, loaningVM);

            if (result)
            {
                message = Request.CreateResponse(HttpStatusCode.OK);
            }
            return(message);
        }
 public bool Update(int id, LoaningVM loaningVM)
 {
     if (string.IsNullOrWhiteSpace(loaningVM.Id.ToString()))
     {
         return(status);
     }
     else
     {
         return(iLoaningRepository.Update(id, loaningVM));
     }
 }
Exemple #11
0
 public bool Insert(LoaningVM loaningVM)
 {
     if (loaningVM.DateLoaning == null)
     {
         return(status);
     }
     else
     {
         return(iLoaningRepository.Insert(loaningVM));
     }
 }
        public bool Update(int id, LoaningVM loaningVM)
        {
            var get = Get(id);

            if (get != null)
            {
                get.Update(id, loaningVM);
                myContext.Entry(get).State = EntityState.Modified;
                myContext.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool Update(int id, LoaningVM loaningVM)
        {
            var get         = Get(id);
            var getTypeItem = myContext.TypeItems.Find(loaningVM.TypeItem_Id);
            var getItem     = myContext.Items.Find(loaningVM.Item_Id);

            get.TypeItem = getTypeItem;
            get.Item     = getItem;
            if (get != null)
            {
                get.Update(id, loaningVM);
                myContext.Entry(get).State = EntityState.Modified;
                myContext.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public bool Insert(LoaningVM loaningVM)
        {
            var push        = new Loaning(loaningVM);
            var getTypeItem = myContext.TypeItems.Find(loaningVM.TypeItem_Id);
            var getItem     = myContext.Items.Find(loaningVM.Item_Id);

            push.TypeItem = getTypeItem;
            push.Item     = getItem;
            myContext.Loanings.Add(push);
            var result = myContext.SaveChanges();

            if (result > 0)
            {
                status = true;
            }
            else
            {
                return(status);
            }
            return(status);
        }
Exemple #15
0
 public bool Update(int id, LoaningVM loaningVM)
 {
     return(iLoaningRepository.Update(id, loaningVM));
 }