Esempio n. 1
0
        public object Put(UpdateJournal message)
        {
            var sw = Stopwatch.StartNew();

            using (var db = _connectionFactory.Open())
            {
                var journal = db.SelectByIds <Journal>(new long[] { message.Id }).FirstOrDefault();
                if (journal == null)
                {
                    return new HttpResult()
                           {
                               StatusCode = HttpStatusCode.NotFound
                           }
                }
                ;

                try
                {
                    journal.Name = message.Name;

                    journal.Description = message.Description;
                    db.Update(journal);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            sw.Stop();
            return(new JournalResponse {
                TimeTakenMs = sw.ElapsedMilliseconds
            });
        }
Esempio n. 2
0
        public object Put(UpdateJournal message)
        {
            var sw = Stopwatch.StartNew();
            using (var db = _connectionFactory.Open())
            {
                var journal = db.SelectByIds<Journal>(new long[] {message.Id}).FirstOrDefault();
                if (journal == null)
                    return new HttpResult() {StatusCode = HttpStatusCode.NotFound};

                try
                {
                    journal.Name = message.Name;
                    journal.Description = message.Description;
                    db.Update(journal);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            sw.Stop();
            return new JournalResponse {TimeTakenMs = sw.ElapsedMilliseconds};
        }