Ejemplo n.º 1
0
        public static IEnumerable<Model> GetList(string some=null)
        {
            SqlParameter pSome = new SqlParameter() { ParameterName = "some", SqlValue = some, SqlDbType = SqlDbType.NVarChar };
            var dt = Db.Stuff.ExecuteQueryStoredProcedure("get_model_list", pSome);

            var lst = new List<Model>();

            foreach (DataRow row in dt.Rows)
            {
                var model = new Model(row);
                lst.Add(model);
            }

            return lst;
        }
Ejemplo n.º 2
0
        public HttpResponseMessage Save(Model model)
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.Created);

            try
            {
                model.CurUserAdSid = GetCurUser().Sid;
                model.Save();
                response.Content = new StringContent($"{{\"id\":{model.Id}}}");
            }
            catch (Exception ex)
            {
                response = new HttpResponseMessage(HttpStatusCode.OK);
                response.Content = new StringContent(MessageHelper.ConfigureExceptionMessage(ex));

            }
            return response;
        }
Ejemplo n.º 3
0
 public Model Get(int id)
 {
     var model = new Model(id);
     return model;
 }