public void Update(LoanRequestDetailVM loanrequestdetailVM)
 {
     this.Quantity  = loanrequestdetailVM.Quantity;
     this.AssetName = loanrequestdetailVM.AssetName;
     //this.Role = Convert.ToInt32(userVM.RoleId);
     this.UpdateDate = DateTimeOffset.Now.LocalDateTime;
 }
 public LoanRequestDetail(LoanRequestDetailVM loanrequestdetailVM)
 {
     this.Quantity  = loanrequestdetailVM.Quantity;
     this.AssetName = loanrequestdetailVM.AssetName;
     //this.Role_Id = userVM.Role_Id;
     this.CreateDate = DateTimeOffset.Now.LocalDateTime;
 }
        public bool Insert(LoanRequestDetailVM loanrequestdetailVM)
        {
            var push = new LoanRequestDetail(loanrequestdetailVM);

            if (push != null)
            {
                var getLoanRequest = applicationcontext.LoanRequests.SingleOrDefault(x => x.IsDelete == false && x.Id == loanrequestdetailVM.LoanRequestId);
                push.LoanRequest = getLoanRequest;
                applicationcontext.LoanRequestDetails.Add(push);
                var result = applicationcontext.SaveChanges();
                return(result > 0);
            }
            else
            {
                return(false);
            }
        }
        public bool Update(int id, LoanRequestDetailVM loanrequestdetailVM)
        {
            var get = Get(id);

            if (get != null)
            {
                var getLoanRequest = applicationcontext.LoanRequests.SingleOrDefault(x => x.IsDelete == false && x.Id == loanrequestdetailVM.LoanRequestId);
                get.LoanRequest = getLoanRequest;
                get.Update(loanrequestdetailVM);
                // entry data yang akan di ubah, state mengacu sebelah kanan supaya kita mendapatkan modified
                applicationcontext.Entry(get).State = EntityState.Modified;
                var result = applicationcontext.SaveChanges();
                return(result > 0);
            }
            else
            {
                return(false);
            }
        }
 public bool Update(int id, LoanRequestDetailVM loanrequestdetailVM)
 {
     return(iloanrequestdetailrepository.Update(id, loanrequestdetailVM));
 }
 public bool Insert(LoanRequestDetailVM loanrequestdetailVM)
 {
     return(iloanrequestdetailrepository.Insert(loanrequestdetailVM));
 }