Exemple #1
0
        public bool UpdateInstClassification(InstrumentClassificationEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Classifications
                    .Single(e => e.ClassificationId == model.ClassificationId);

                entity.TypeOfCategory   = model.TypeOfCategory;
                entity.TypeOfInstrument = model.TypeOfInstrument;

                return(ctx.SaveChanges() == 1);
            }
        }
Exemple #2
0
        public IHttpActionResult Put(InstrumentClassificationEdit classification)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateClassificationService();

            if (!service.UpdateInstClassification(classification))
            {
                return(InternalServerError());
            }

            return(Ok());
        }