重构代码:替换xml标注,设置属性为只读
This commit is contained in:
parent
7d577571a1
commit
4903e798c2
|
@ -15,7 +15,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 显示所有异常
|
/// 显示所有异常
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="value"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public QueryData<Exceptions> Get([FromUri]QueryExceptionOption value)
|
public QueryData<Exceptions> Get([FromUri]QueryExceptionOption value)
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="value"></param>
|
||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
public bool Delete([FromBody]string value)
|
public bool Delete([FromBody]string value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(p.UserName) || string.IsNullOrEmpty(p.Password) || string.IsNullOrEmpty(p.DisplayName) || string.IsNullOrEmpty(p.Description)) return View();
|
if (string.IsNullOrEmpty(p.UserName) || string.IsNullOrEmpty(p.Password) || string.IsNullOrEmpty(p.DisplayName) || string.IsNullOrEmpty(p.Description)) return View();
|
||||||
p.UserStatus = 1;
|
p.UserStatus = 1;
|
||||||
return UserHelper.SaveUser(p) ? (ActionResult)base.Redirect("~/Content/html/RegResult.html") : View();
|
return UserHelper.SaveUser(p) ? (ActionResult)Redirect("~/Content/html/RegResult.html") : View();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
|
@ -4,6 +4,7 @@ using Longbow.Caching;
|
||||||
using Longbow.Security.Principal;
|
using Longbow.Security.Principal;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
using System.Web.Security;
|
using System.Web.Security;
|
||||||
|
@ -24,8 +25,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userName"></param>
|
/// <param name="value"></param>
|
||||||
/// <param name="password"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -36,7 +36,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
string password = user.password;
|
string password = user.password;
|
||||||
if (LgbPrincipal.Authenticate(userName, password) || BootstrapUser.Authenticate(userName, password))
|
if (LgbPrincipal.Authenticate(userName, password) || BootstrapUser.Authenticate(userName, password))
|
||||||
{
|
{
|
||||||
var interval = int.Parse(Math.Round(FormsAuthentication.Timeout.TotalSeconds).ToString());
|
var interval = int.Parse(Math.Round(FormsAuthentication.Timeout.TotalSeconds).ToString(CultureInfo.InvariantCulture));
|
||||||
var token = CacheManager.AddOrUpdate(string.Format("WebApi-{0}", userName), interval, k => new LoginInfo() { UserName = userName, Token = Guid.NewGuid().ToString() }, (k, info) => info, "WebApi 数据缓存");
|
var token = CacheManager.AddOrUpdate(string.Format("WebApi-{0}", userName), interval, k => new LoginInfo() { UserName = userName, Token = Guid.NewGuid().ToString() }, (k, info) => info, "WebApi 数据缓存");
|
||||||
CacheManager.AddOrUpdate(token.Token, interval, k => token, (k, info) => info, "Token 数据缓存");
|
CacheManager.AddOrUpdate(token.Token, interval, k => token, (k, info) => info, "Token 数据缓存");
|
||||||
return token;
|
return token;
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="value"></param>
|
||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
public bool Delete([FromBody]string value)
|
public bool Delete([FromBody]string value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据Id返回不同的消息列表
|
/// 根据Id返回不同的消息列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<Message> Get(string id)
|
public IEnumerable<Message> Get(string id)
|
||||||
|
@ -20,13 +20,17 @@ namespace Bootstrap.Admin.Controllers
|
||||||
var ret = new List<Message>();
|
var ret = new List<Message>();
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case "inbox": ret = MessageHelper.Inbox(User.Identity.Name).ToList();
|
case "inbox":
|
||||||
|
ret = MessageHelper.Inbox(User.Identity.Name).ToList();
|
||||||
break;
|
break;
|
||||||
case "sendmail": ret = MessageHelper.SendMail(User.Identity.Name).ToList();
|
case "sendmail":
|
||||||
|
ret = MessageHelper.SendMail(User.Identity.Name).ToList();
|
||||||
break;
|
break;
|
||||||
case "mark": ret = MessageHelper.Mark(User.Identity.Name).ToList();
|
case "mark":
|
||||||
|
ret = MessageHelper.Mark(User.Identity.Name).ToList();
|
||||||
break;
|
break;
|
||||||
case "trash": ret = MessageHelper.Trash(User.Identity.Name).ToList();
|
case "trash":
|
||||||
|
ret = MessageHelper.Trash(User.Identity.Name).ToList();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -35,16 +39,17 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 返回各个消息列表的文件个数
|
/// 返回各个消息列表的文件个数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public MessageCountModel Get()
|
public MessageCountModel Get()
|
||||||
{
|
{
|
||||||
MessageCountModel mcm = new MessageCountModel();
|
var mcm = new MessageCountModel
|
||||||
mcm.inboxCount = MessageHelper.Inbox(User.Identity.Name).Count();
|
{
|
||||||
mcm.sendmailCount = MessageHelper.SendMail(User.Identity.Name).Count();
|
InboxCount = MessageHelper.Inbox(User.Identity.Name).Count(),
|
||||||
mcm.markCount = MessageHelper.Mark(User.Identity.Name).Count();
|
SendmailCount = MessageHelper.SendMail(User.Identity.Name).Count(),
|
||||||
mcm.trashCount = MessageHelper.Trash(User.Identity.Name).Count();
|
MarkCount = MessageHelper.Mark(User.Identity.Name).Count(),
|
||||||
|
TrashCount = MessageHelper.Trash(User.Identity.Name).Count()
|
||||||
|
};
|
||||||
return mcm;
|
return mcm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,12 @@ namespace Bootstrap.Admin.Controllers
|
||||||
{
|
{
|
||||||
return value.RetrieveData();
|
return value.RetrieveData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IEnumerable<Role> Post(int id, [FromBody]JObject value)
|
public IEnumerable<Role> Post(int id, [FromBody]JObject value)
|
||||||
|
@ -47,9 +49,10 @@ namespace Bootstrap.Admin.Controllers
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>根据GroupID获取
|
/// <summary>根据GroupID获取
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="value"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPut]
|
[HttpPut]
|
||||||
public bool Put(int id, [FromBody]JObject value)
|
public bool Put(int id, [FromBody]JObject value)
|
||||||
|
@ -85,7 +88,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="value"></param>
|
||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
public bool Delete([FromBody]string value)
|
public bool Delete([FromBody]string value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,8 +4,15 @@ using System.Web.Http;
|
||||||
|
|
||||||
namespace Bootstrap.Admin.Controllers
|
namespace Bootstrap.Admin.Controllers
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class TasksController : ApiController
|
public class TasksController : ApiController
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<Task> Get()
|
public IEnumerable<Task> Get()
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="roleId"></param>
|
/// <param name="id"></param>
|
||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -73,7 +73,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="userName"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public User Get(string userName)
|
public User Get(string userName)
|
||||||
|
@ -133,7 +133,7 @@ namespace Bootstrap.Admin.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="value"></param>
|
||||||
[HttpDelete]
|
[HttpDelete]
|
||||||
public bool Delete([FromBody]string value)
|
public bool Delete([FromBody]string value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,17 +14,17 @@ namespace Bootstrap.Admin.Models
|
||||||
Icon = user.Icon;
|
Icon = user.Icon;
|
||||||
DisplayName = user.DisplayName;
|
DisplayName = user.DisplayName;
|
||||||
UserName = user.UserName;
|
UserName = user.UserName;
|
||||||
UserID = user.ID;
|
UserId = user.ID;
|
||||||
}
|
}
|
||||||
public string UserName { get; protected set; }
|
public string UserName { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UserID { get; protected set; }
|
public int UserId { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DisplayName { get; protected set; }
|
public string DisplayName { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -32,6 +32,6 @@ namespace Bootstrap.Admin.Models
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得/设置 用户头像地址
|
/// 获得/设置 用户头像地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Icon { get; set; }
|
public string Icon { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,13 +5,6 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LoginModel : ModelBase
|
public class LoginModel : ModelBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public LoginModel()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,15 +1,25 @@
|
||||||
using System;
|
namespace Bootstrap.Admin.Models
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Bootstrap.Admin.Models
|
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public class MessageCountModel
|
public class MessageCountModel
|
||||||
{
|
{
|
||||||
public int inboxCount { get; set; }
|
/// <summary>
|
||||||
public int sendmailCount { get; set; }
|
///
|
||||||
public int markCount { get; set; }
|
/// </summary>
|
||||||
public int trashCount { get; set; }
|
public int InboxCount { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int SendmailCount { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int MarkCount { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int TrashCount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,9 @@ namespace Bootstrap.Admin.Models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ModelBase
|
public class ModelBase
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
public ModelBase()
|
public ModelBase()
|
||||||
{
|
{
|
||||||
Title = DictHelper.RetrieveWebTitle();
|
Title = DictHelper.RetrieveWebTitle();
|
||||||
|
@ -15,8 +18,10 @@ namespace Bootstrap.Admin.Models
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Title { get; set; }
|
public string Title { get; private set; }
|
||||||
|
/// <summary>
|
||||||
public string Footer { get; set; }
|
///
|
||||||
|
/// </summary>
|
||||||
|
public string Footer { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,10 +27,10 @@ namespace Bootstrap.Admin.Models
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<Menu> Navigations { get; set; }
|
public IEnumerable<Menu> Navigations { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<KeyValuePair<string, string>> Applications { get; set; }
|
public IEnumerable<KeyValuePair<string, string>> Applications { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@ namespace Bootstrap.Admin.Models
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得/设置 头像文件大小
|
/// 获得/设置 头像文件大小
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long Size { get; set; }
|
public long Size { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<input id="userId" type="text" class="hidden" value="@Model.UserID" />
|
<input id="userId" type="text" class="hidden" value="@Model.UserId" />
|
||||||
}
|
}
|
||||||
@section toolbar {
|
@section toolbar {
|
||||||
<button id="btn_assignRole" type="button" class="btn btn-info">
|
<button id="btn_assignRole" type="button" class="btn btn-info">
|
||||||
|
|
Loading…
Reference in New Issue