public UserArc UpdateUserArc(UserArc modifyUserArc, UserArc originalUserArc)
 {
     dbContext.Entry(originalUserArc).CurrentValues.SetValues(modifyUserArc);
     dbContext.Entry(originalUserArc).Property(x => x.UserId).IsModified     = false;
     dbContext.Entry(originalUserArc).Property(x => x.CreateTime).IsModified = false;
     originalUserArc.UpdateTime = DateTime.UtcNow;
     dbContext.SaveChanges();
     return(modifyUserArc);
 }
        public void UpdateTransactionStatus(long recordId, short transactionStatus, string comment)
        {
            var record = _context.RemitRecord.SingleOrDefault(x => x.Id == recordId);

            _context.Entry(record).Reference(record => record.ToCurrency).Load();
            var exchangeRate = _context.ExchangeRate.SingleOrDefault(x => x.CurrencyName.Equals(record.ToCurrency.CurrencyName));
            var originalTransactionStatus = record.TransactionStatus;

            if (record == null)
            {
                return;
            }
            record.TransactionStatus       = transactionStatus;
            record.TransactionExchangeRate = exchangeRate.Rate;
            RemitAdminReviewLog reviewLog = new RemitAdminReviewLog()
            {
                RemitRecordId         = recordId,
                FromTransactionStatus = originalTransactionStatus,
                ToTransactionStatus   = transactionStatus,
                Note = comment
            };

            record.RemitAdminReviewLog.Add(reviewLog);
            _context.Update(record);
            _context.SaveChanges();
        }
        public async Task <IActionResult> PutUserPreferences([FromRoute] int id, [FromBody] UserPreferences userPreferences)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                UserPreferences oldUserPreferences = await _context.UserPreference.FirstOrDefaultAsync(e => e.UserID == id);

                if (oldUserPreferences == null)
                {
                    return(NotFound());
                }

                if (id != userPreferences.UserID)
                {
                    return(BadRequest());
                }

                oldUserPreferences.SystemLanguange = userPreferences.SystemLanguange;
                oldUserPreferences.Currency        = userPreferences.Currency;

                _context.Entry(userPreferences).State = EntityState.Modified;
                await _context.SaveChangesAsync();

                return(NoContent());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public async Task <IActionResult> PutHouse(long id, House house)
        {
            if (id != house.Id)
            {
                return(BadRequest());
            }

            _context.Entry(house).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HouseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutApartment(long id, Apartment apartment)
        {
            if (id != apartment.Id)
            {
                return(BadRequest());
            }

            _context.Entry(apartment).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ApartmentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #6
0
 public ActionResult Edit([Bind(Include = "Id,Nombre,Apellido,Direccion")] Cliente cliente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cliente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cliente));
 }
 public ActionResult Edit(Cliente cliente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cliente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cliente));
 }
 public ActionResult Edit([Bind(Include = "Id,Nombre,CodigoPostal,Edad,Email,TarjetaCredito")] Persona persona)
 {
     if (ModelState.IsValid)
     {
         db.Entry(persona).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(persona));
 }
Beispiel #9
0
 public ActionResult Edit([Bind(Include = "Id,Capital,Intereses,Periodo,ClientesId")] Prestamos prestamos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(prestamos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClientesId = new SelectList(db.Clientes, "Id", "Nombre", prestamos.ClientesId);
     return(View(prestamos));
 }
Beispiel #10
0
 public OftenBeneficiary AddBeneficiar(OftenBeneficiary Beneficiary)
 {
     dbContext.OftenBeneficiary.Add(Beneficiary);
     dbContext.SaveChanges();
     dbContext.Entry(Beneficiary).Reference(Beneficiary => Beneficiary.PayeeType).Load();
     return(Beneficiary);
 }
Beispiel #11
0
 public bool ModifyPayeeRelation(PayeeRelationType modifyRelation)
 {
     try
     {
         PayeeRelationType relation = dbContext.PayeeRelationType.Single(x => x.Id == modifyRelation.Id);
         dbContext.Entry(relation).CurrentValues.SetValues(modifyRelation);
         dbContext.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         logger.LogDebug(ex.Message);
     }
     return(false);
 }
 public bool ModifyReceiveBank(ReceiveBank modifyBank)
 {
     try
     {
         ReceiveBank bank = dbContext.ReceiveBank.Single(x => x.Id == modifyBank.Id);
         dbContext.Entry(bank).CurrentValues.SetValues(modifyBank);
         dbContext.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         logger.LogDebug(ex.Message);
     }
     return(false);
 }
Beispiel #13
0
 public bool ModifyCurrency(CurrencyCode modifyCurrency)
 {
     try
     {
         CurrencyCode currency = dbContext.CurrencyCode.Single(x => x.Id == modifyCurrency.Id);
         dbContext.Entry(currency).CurrentValues.SetValues(modifyCurrency);
         dbContext.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         logger.LogDebug(ex.Message);
     }
     return(false);
 }
Beispiel #14
0
 public bool ModifyRemitSetting(BussinessUnitRemitSetting modifyRemitSetting)
 {
     try
     {
         BussinessUnitRemitSetting remitSetting = dbContext.BussinessUnitRemitSetting.Single(x => x.Id == modifyRemitSetting.Id);
         dbContext.Entry(remitSetting).CurrentValues.SetValues(modifyRemitSetting);
         dbContext.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         logger.LogDebug(ex.Message);
     }
     return(false);
 }
Beispiel #15
0
        public RemitRecord CreateRemitRecordByUserArc(UserArc userArc, RemitRecord remitRecord, PayeeTypeEnum payeeTypeEnum)
        {
            remitRecord.UserId    = userArc.UserId;
            remitRecord.ArcName   = userArc.ArcName;
            remitRecord.ArcNo     = userArc.ArcNo;
            remitRecord.PayeeType = (byte)payeeTypeEnum;

            dbContext.RemitRecord.Add(remitRecord);
            dbContext.SaveChanges();
            dbContext.Entry(remitRecord).Reference(record => record.Beneficiary).Query()
            .Include(Beneficiary => Beneficiary.PayeeRelation)
            .Load();
            dbContext.Entry(remitRecord).Reference(record => record.ToCurrency).Load();

            return(remitRecord);
        }
 public void Modify(User user)
 {
     _context.Entry(user).State = EntityState.Modified;
     _context.SaveChanges();
 }
        public IHttpActionResult Post([FromBody] Personas persona)
        {
            if (persona.status == "guardar")
            {
                db.Personas.Add(persona);
                db.SaveChanges();
            }
            else if (persona.status == "eliminar")
            {
                var pp = db.Personas.ToList().Find(x => x.IdPersona == persona.IdPersona);
                db.Personas.Remove(pp);
                db.SaveChanges();
            }
            else if (persona.status == "editar")
            {
                var pp = db.Personas.ToList().Find(x => x.IdPersona == persona.IdPersona);
                pp.Nombre   = persona.Nombre;
                pp.Apellido = persona.Apellido;
                pp.Correo   = persona.Correo;
                pp.Telefono = persona.Telefono;

                db.Entry(pp).State = EntityState.Modified;
                db.SaveChanges();
            }
            else if (persona.status == "buscar")
            {
                if (persona.Nombre == "id")
                {
                    persona.IdPersona = Convert.ToInt32(persona.Apellido);
                    var pp = db.Personas.ToList().Find(x => x.IdPersona == persona.IdPersona);

                    var list = new List <Personas>();

                    list.Add(pp);
                    return(Json(list));
                }
                else if (persona.Nombre == "nombre")
                {
                    var pp = BuscarNombre(persona.Apellido);

                    return(Json(pp));
                }
                else if (persona.Nombre == "apellido")
                {
                    var pp = BuscarApellido(persona.Apellido);
                    return(Json(pp));
                }
                else if (persona.Nombre == "correo")
                {
                    var pp = BuscarCorreo(persona.Apellido);

                    return(Json(pp));
                }
                else if (persona.Nombre == "telefono")
                {
                    var pp = BuscarTelefono(persona.Apellido);

                    return(Json(pp));
                }
            }


            return(Ok());
        }