1
0
mirror of https://github.com/bitwarden/server synced 2025-12-17 00:33:23 +00:00

move all models into core

This commit is contained in:
Kyle Spearrin
2017-03-08 21:55:08 -05:00
parent bd0c960e9f
commit 8bcd4e0463
60 changed files with 64 additions and 64 deletions

View File

@@ -0,0 +1,51 @@
using System;
using Bit.Core.Models.Table;
using Newtonsoft.Json;
namespace Bit.Core.Models.Api
{
public class LoginDataModel
{
public LoginDataModel() { }
public LoginDataModel(LoginRequestModel login)
{
Name = login.Name;
Uri = login.Uri;
Username = login.Username;
Password = login.Password;
Notes = login.Notes;
}
public LoginDataModel(CipherRequestModel cipher)
{
Name = cipher.Name;
Uri = cipher.Uri;
Username = cipher.Username;
Password = cipher.Password;
Notes = cipher.Notes;
}
public LoginDataModel(Cipher cipher)
{
if(cipher.Type != Core.Enums.CipherType.Login)
{
throw new ArgumentException("Cipher is not correct type.");
}
var data = JsonConvert.DeserializeObject<LoginDataModel>(cipher.Data);
Name = data.Name;
Uri = data.Uri;
Username = data.Username;
Password = data.Password;
Notes = data.Notes;
}
public string Name { get; set; }
public string Uri { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Notes { get; set; }
}
}